Embedded Systems: Assist. Prof. Rassim Suliyev - SDU 2018 Week 2
Embedded Systems: Assist. Prof. Rassim Suliyev - SDU 2018 Week 2
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
8
LilyPad ATmega328P 2.7-5.5 V 6/0 14/6 0.512 1 16 -
MHz
400MH
Yun AR9331 Linux 5V 12/0 20/7 1 16MB 64 MB 1
z
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.
Proteus ISIS Simulation System
For Windows XP
Copy file BLOGEMBARCADO.LIB into:
C:\Program Files\Labcenter Electronics\Proteus 8 Professional\Data\LIBRARY
Double click
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
Hidden Treasure
int main(void)
{
init(); // initializes the Arduino hardware
setup();
for (;;)
loop();
return 0;
}
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;
}
}
This is because the only memory-efficient way that floating-point numbers can contain the huge
range in values they can represent is by storing an approximation of the number.
The solution to this is to check if a variable is close to the desired value.
Arrays
Arrays are zero indexed, with the first value in the array beginning at index number
0. An array needs to be declared and optionally assigned values before they can be
used.
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: