File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
libraries/SME_basic/examples/fadeRGB
variants/AMEL_SmartEverything Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Shows The PWM functionalities on the RGB Led
3
+
4
+ created 18 Jun 2015
5
+
6
+
7
+ */
8
+
9
+ #include < Arduino.h>
10
+
11
+ long randNumberR, randNumberG, randNumberB;
12
+
13
+ void setup (){
14
+ randomSeed (analogRead (0 ));
15
+ }
16
+
17
+ void loop (){
18
+ randNumberR = random (128 );
19
+ randNumberG = random (128 );
20
+ randNumberB = random (128 );
21
+
22
+
23
+
24
+ ledGreenLight (randNumberG);
25
+ ledBlueLight (randNumberB);
26
+ ledRedLight (randNumberR);
27
+
28
+ delay (500 );
29
+ }
Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ void ledGreenLight(uint32_t value) {
279
279
} else if (value == LOW) {
280
280
digitalWrite (PIN_LED_GREEN, HIGH);
281
281
} else {
282
- digitalWrite (PIN_LED_GREEN, 255 -value); // in case of PWM
282
+ analogWrite (PIN_LED_GREEN, 255 -value); // in case of PWM
283
283
}
284
284
}
285
285
@@ -289,7 +289,7 @@ void ledRedLight(uint32_t value) {
289
289
} else if (value == LOW) {
290
290
digitalWrite (PIN_LED_RED, HIGH);
291
291
} else {
292
- digitalWrite (PIN_LED_RED, 255 -value); // in case of PWM
292
+ analogWrite (PIN_LED_RED, 255 -value); // in case of PWM
293
293
}
294
294
}
295
295
@@ -299,7 +299,7 @@ void ledBlueLight(uint32_t value) {
299
299
} else if (value == LOW) {
300
300
digitalWrite (PIN_LED_BLUE, HIGH);
301
301
} else {
302
- digitalWrite (PIN_LED_BLUE, 255 -value); // in case of PWM
302
+ analogWrite (PIN_LED_BLUE, 255 -value); // in case of PWM
303
303
}
304
304
}
305
305
You can’t perform that action at this time.
0 commit comments