Upgrade to remove ads
Arduino Basic commands Master
For Use with the Spark Fun Inventors kit
Terms in this set (27)
// is a one line Comment
/* this is a
multiline Comment */
setup() and loop()
these are two specific functions that the arduino must have. setup() is used to do things you only need done once
Sets up pin 13 to be an output. Thereby voltage is being sent out by the Arduino through pin 13 to do what ever you want it to do.
input of on or off. these signals will always be 5 volts ("HIGH") or 0 Volts or ("LOW")
built in function that we use to make an output pin HIGH or LOW. it takes two values; a pin a number, followed by the word HIGH or LOW. Example: digitalWrite(13, HIGH); this sends v Volts through pin 13.
function that pauses for a given amount of time. takes one value of time to delay in milliseconds. Example: delay(1000); delays for 1 second.
control knob. it changes resistance as it is turned.
named number. several types: Int signifies an integer. Integers can range from 32768 to 32767.
variables that are declared outside of a function, and can be seen by all functions.
Arduino can read external voltages on the analog imput pins. It returns an integer of 0 ( 0 Volts) to 1023 (5 volts)
Red Green Blue
putting this in front of a variable means that it will never change once given a value.
three statements separated by semicolons:
1. something to do before starting
2. a test to perform; as long as its true, it will keep looping
3. something to do after each loop (Usually increase a variable.)
for (x = 0; x < 768; x++)
add one two it. same as x=x+1
base numbers for color
0 = pure red
767 = pure red
if else statements
if (This statement is true)
then do this;
else (the if statement is not true)
then do this;
built in function that you can use in you sketches to send a message back to the serial monitor.
Serial.println(x); ==> x shows up on the computer screen
opens the serial port and sets data rate to 9600 bps
allows you to associate a value with a name.Everywhere that this name appears in your sketch, the value will be substituted before the sketch is compiled.
example: pin assignment: #define ledPin 13
use only if you need to save memory: #define does not use memory
empty parentheses ()
function takes no parameters
when static is used in front of a variable declaration in a function, it has the effect of initializing the variable only the first time that the function is run.
Any non void function has to have a return statement in it. int functions return ints
variables with a decimal point
type of logic, more later
boolean operator "and"
boolean operator "or"
OTHER SETS BY THIS CREATOR
4) The Young Modulus
Wayside Puerto Rican Food Master