Arduino - Loops
Arduino - Loops
Arduino - Loops
2
While loop
3
Do while loop
4
For loop
5
Nested Loop
Loop inside another loop.
6
Functions
Functions
Functions allow structuring the programs in segments of code to perform individual tasks. The typical
case for creating a function is when one needs to perform the same action multiple times in a
program.
8
Functions
9
Functions
void setup(){
Serial.begin(9600);
}
void loop() {
int myMultiplyFunction(int x, int y){
int result;
result = x * y;
return result;
}
10
Functions
11
Functions
Arduino Function Example 3 - BlinkLed3
Blinks an LED - part of a series to experiment with functions
Creative Technology Course by Philip van Allen - ArtCenter College of Design
*/
const int LED1 = 13;
const int LED2 = 5;
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pins as outputs.
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
}
12
4