Skip to content

Commit 747a7b9

Browse files
Create leds-py.ino
1 parent 41131f8 commit 747a7b9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Control-LEDs-With-Python/leds-py.ino

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <cvzone.h>
2+
#define RLed 2
3+
#define YLed 3
4+
#define GLed 4
5+
6+
SerialData data(3, 1); // (number of received values, number of digits in each value)
7+
int receivedVals[3];
8+
9+
void setup() {
10+
data.begin();
11+
pinMode(RLed, OUTPUT);
12+
pinMode(YLed, OUTPUT);
13+
pinMode(GLed, OUTPUT);
14+
}
15+
16+
void loop() {
17+
int leds[3] = {RLed, YLed, GLed};
18+
data.Get(receivedVals);
19+
for (int i=0; i<3; ++i) {
20+
digitalWrite(leds[i], receivedVals[i]);
21+
}
22+
delay(10);
23+
}

0 commit comments

Comments
 (0)