2 changed files with 23 additions and 8 deletions
@ -1,18 +1,32 @@
|
||||
#include <Arduino.h> |
||||
|
||||
// put function declarations here:
|
||||
int myFunction(int, int); |
||||
int ledsCount = 4; |
||||
int ledPins[] = {12,11,10,9}; |
||||
|
||||
|
||||
void setup() { |
||||
// 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() { |
||||
// put your main code here, to run repeatedly:
|
||||
} |
||||
|
||||
// put function definitions here:
|
||||
int myFunction(int x, int y) { |
||||
return x + y; |
||||
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);
|
||||
} |
||||
} |
||||
Loading…
Reference in new issue