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+ by Mik (smkk@amel-tech.com)
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) {
279279 } else if (value == LOW) {
280280 digitalWrite (PIN_LED_GREEN, HIGH);
281281 } else {
282- digitalWrite (PIN_LED_GREEN, 255 -value); // in case of PWM
282+ analogWrite (PIN_LED_GREEN, 255 -value); // in case of PWM
283283 }
284284}
285285
@@ -289,7 +289,7 @@ void ledRedLight(uint32_t value) {
289289 } else if (value == LOW) {
290290 digitalWrite (PIN_LED_RED, HIGH);
291291 } else {
292- digitalWrite (PIN_LED_RED, 255 -value); // in case of PWM
292+ analogWrite (PIN_LED_RED, 255 -value); // in case of PWM
293293 }
294294}
295295
@@ -299,7 +299,7 @@ void ledBlueLight(uint32_t value) {
299299 } else if (value == LOW) {
300300 digitalWrite (PIN_LED_BLUE, HIGH);
301301 } else {
302- digitalWrite (PIN_LED_BLUE, 255 -value); // in case of PWM
302+ analogWrite (PIN_LED_BLUE, 255 -value); // in case of PWM
303303 }
304304}
305305
You can’t perform that action at this time.
0 commit comments