EasyManua.ls Logo

Seeed Grove - Arduino: Temperature-Controlled Color Demo

Seeed Grove
29 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
7/23/22, 9:41 PM
Grove - Chainable RGB LED - Seeed Wiki
https://wiki.seeedstudio.com/Grove-Chainable_RGB_LED/
5/29
You can observe this scene: colors of ve LED will gradient
consistently.
Extended application: Based on Chainable LED Library
[https://github.com/pjpmarques/ChainableLED], we have designed
this demo: RGB color varies with the temperature measured by
Grove - temperature. The RGB color vary from green to red when the
temperature is from 25 to 32. The test code is shown below. Do it if
you are interested in it.
32
33 if (hue>=1.0 && up)
34 up = false;
35 else if (hue<=0.0 && !up)
36 up = true;
37 }
1 // demo of temperature -> rgbLED
2 // temperature form 25 - 32, rgbLed from green -> red
3 // Grove-temperature plu to A0
4 // LED plug to D7,D8
5
6 #include <Streaming.h>
7 #include <ChainableLED.h>
8
9 #define TEMPUP 32
10 #define TEMPDOWN 25
11
12 ChainableLED leds(7, 8, 1); // connect to pin7 and pi
13
14 int getAnalog() // get value from A0
15 {
16 int sum = 0;
17 for(int i=0; i<32; i++)
18 {
19 sum += analogRead(A0);
20 }

Other manuals for Seeed Grove

Related product manuals