Lecture5 - Arduino IOT
Lecture5 - Arduino IOT
EVERYTHING
What is Arduino?
http://www.arduino.cc
Arduino Philosophy and
Community
Open Source Physical Computing Platform
“open source hardware”
physical computing
ubiquitous computing
pervasive computing
ambient intelligence
calm computing
Spimes
Blogjects
smart objects
Community-built
Examples wiki (the “playground”) editable by anyone
And all over the Net. Search for “Arduino tutorial” or “Arduino notes” or whatever you’re interested in and “Arduino”
and likely you’ll find some neat pages.
Useful Links
http://arduino.cc/
Official homepage. Also check out the Playground & forums
http://arduino.ru/
pinMode(pin, mode);
Configures a digital pin to read (input) or write (output) a digital value
digitalRead(pin);
Reads a digital value (HIGH or LOW) on a pin set for input
digitalWrite(pin, value);
Writes the digital value (HIGH or LOW) to a pin set for output
delay(value)
Stops the program execution for amount of milliseconds given by
value
Arduino data types
Flow control
1. if
if(expression){ //if expression is true if (inputPin < 500){
doSomething; doThingA;
} }
else if (inputPin >= 1000){
2. if… else doThingB;
if(inputPin == HIGH){ }
doThingA; else{
} else{ doThingC;
doThingB; }
}
3. for
for(j=0; j < 4; j++ ){
for (initialization; condition; expression){
Serial.println(j);
doSomething;
}
}
Likewise it is possible to declare an array by declaring the array type and size and
later assign values to an index position
To retrieve a value from an array, assign a variable to the array and index position: