source: rtos_arduino/trunk/examples/NCESIoT_RTOS/ChainableLED/examples/SimpleCycle/SimpleCycle.ino@ 243

Last change on this file since 243 was 243, checked in by ertl-honda, 8 years ago

IoTパッケージの内容に合わせて更新

File size: 493 bytes
Line 
1
2/*
3 * Example of using the ChainableRGB library for controlling a Grove RGB.
4 * This code puts a red dot (led) moving along a strip of blue dots.
5 */
6
7#include <ChainableLED.h>
8
9#define NUM_LEDS 5
10
11ChainableLED leds(7, 8, NUM_LEDS);
12
13void setup()
14{
15 leds.init();
16}
17
18byte pos = 0;
19
20void loop()
21{
22 for (byte i=0; i<NUM_LEDS; i++)
23 {
24 if (i==pos)
25 leds.setColorRGB(i, 255, 0, 0);
26 else
27 leds.setColorRGB(i, 0, 0, 255);
28 }
29 delay(250);
30
31 pos = (pos+1) % NUM_LEDS;
32}
33
Note: See TracBrowser for help on using the repository browser.