2 changed files with 23 additions and 8 deletions
@ -1,18 +1,32 @@ |
|||||||
#include <Arduino.h> |
#include <Arduino.h> |
||||||
|
|
||||||
// put function declarations here:
|
int ledsCount = 4; |
||||||
int myFunction(int, int); |
int ledPins[] = {12,11,10,9}; |
||||||
|
|
||||||
|
|
||||||
void setup() { |
void setup() { |
||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
int result = myFunction(2, 3); |
Serial.begin(115200); |
||||||
|
Serial.println("Start Multiple Led"); |
||||||
|
for (int i = 0; i < ledsCount; i++) |
||||||
|
{ |
||||||
|
pinMode(ledPins[i], OUTPUT); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
void loop() { |
void loop() { |
||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
|
for (int i = 0; i < ledsCount; i++) |
||||||
|
{ |
||||||
|
digitalWrite(ledPins[i], HIGH); |
||||||
|
delay(50); |
||||||
|
digitalWrite(ledPins[i], LOW); |
||||||
|
} |
||||||
|
for (int i = ledsCount -1; i >= 0; i--) |
||||||
|
{ |
||||||
|
digitalWrite(ledPins[i], HIGH); |
||||||
|
delay(50); |
||||||
|
digitalWrite(ledPins[i], LOW);
|
||||||
} |
} |
||||||
|
|
||||||
// put function definitions here:
|
|
||||||
int myFunction(int x, int y) { |
|
||||||
return x + y; |
|
||||||
} |
} |
||||||
Loading…
Reference in new issue