Arduino Workshop 2nd session
In this session, you will find
- A quick revision on C programming language (Data types, if conditions, comparison, logical operators and loops).
- What is the Arduino IDE and how to use it?
- Blinking LED using Arduino.
13. Rules for naming a variable in C
1. Letters, numbers and underscore only. No special symbols are
allowed! ($, #, @, ., &, … are not allowed).
2. The first letter of a variable should be a letter or an underscore.
14. Several ways for naming variables in c
int foo;
char Bar;
float Baz;
bool isRight;
double foo_Bar;
long long int _foo1;
short _ ;
int AbCdE;
int 2foo;
It’s a big problem to start
with a number or any
other special character,
but '_' is allowed.
15. Practice
What is right when declaring a variable and what isn’t?
1- int x;
2- Float Ahmed;
3- double _Ana_Wad_Gamed;
4- char Arduino uno;
5- long long hema*;
6- flot Float1;
7- short Ya_2osayerxD;
8- int ;فاريبل
9- int float;
10- bool TrueOrFalse?;
True
False (float not Float)
True
False (No space between words is allowed)
False (‘*’ or any other unknown symbol are not allowed)
False (no data type called flot)
True
False (Variables must be English characters)
False (float is a reserved key word in c)
False (‘?’ are not allowed)
16.
17.
18.
19. Some functions
of Arduino IDE
pinMode();
digitalWrite();
digitalRead();
analogWrite();
analogRead();
delay();
20. pinMode(pin, mode);
Pins in Arduino can be defined according to its function (INPUT /OUTPUT)
Pin: the number of the pin whose mode you wish to set
mode: INPUT, OUTPUT
21. digitalWrite (number of pin, HIGH/LOW);
To make arduino send digital signal
EX: LEDs OUTPUT digital Signal
22. digitalRead (number of pin);
To make the arduino receives digital signal
EX :
Push button INPUT Digital Signal
25. Here you can define :
-global variables.
-your needed libraries.
-any functions you may need.
Here you can make initialization for :
-pins (type of it I/O ).
-libraries.
Execution of some orders once only .
Put your code here
26. #Make a simple circuit for 2 blinking
LED controlled by an Arduino kit
white led blinks every 1.5 second
&Green led blinks every 2.5 second
43. #Build a circuit of 3 LEDs,
the first one will blink 3 times, the second will blink 5
times and the third will blink 7 times.
And add a buzzer which buzz one time
At the end of each cycle.