// NeoPixel Ring simple sketch (c) 2013 Shae Erisson // released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library #include #ifdef __AVR__ #include #endif // Which pin on the Arduino is connected to the NeoPixels? // On a Trinket or Gemma we suggest changing this to 1 #define PIN 6 // How many NeoPixels are attached to the Arduino? #define NUMPIXELS 5 // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest // example for more information on possible values. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ400); int delayval = 500; // delay for half a second void setup() { kesu(); pixels.begin(); // This initializes the NeoPixel library. } void kesu() { pixels.setPixelColor(0, pixels.Color(0, 0, 0));//青 pixels.setPixelColor(1, pixels.Color(0, 0, 0));//黄 pixels.setPixelColor(2, pixels.Color(0, 0, 0));//黒 pixels.setPixelColor(3, pixels.Color(0, 0, 0));//緑 pixels.setPixelColor(4, pixels.Color(0, 0, 0));//赤 pixels.show(); // This sends the updated pixel color to the hardware. } void gorin() { pixels.setPixelColor(0, pixels.Color(0, 0, 255));//青 pixels.setPixelColor(1, pixels.Color(180, 100, 0));//黄 pixels.setPixelColor(2, pixels.Color(255, 100, 255));//黒 pixels.setPixelColor(3, pixels.Color(255, 0, 0));//緑 pixels.setPixelColor(4, pixels.Color(0, 255, 0));//赤 pixels.show(); // This sends the updated pixel color to the hardware. } void loop() { int s = 200; pixels.setPixelColor(4, pixels.Color(0, 255, 0));//赤 pixels.show(); // This sends the updated pixel color to the hardware. delay(s); // Delay for a period of time (in milliseconds). pixels.setPixelColor(3, pixels.Color(255, 0, 0));//緑 pixels.show(); // This sends the updated pixel color to the hardware. delay(s); // Delay for a period of time (in milliseconds). pixels.setPixelColor(2, pixels.Color(255, 100, 255));//黒 pixels.show(); // This sends the updated pixel color to the hardware. delay(s); // Delay for a period of time (in milliseconds). pixels.setPixelColor(1, pixels.Color(180, 100, 0));//黄 pixels.show(); // This sends the updated pixel color to the hardware. delay(s); // Delay for a period of time (in milliseconds). pixels.setPixelColor(0, pixels.Color(0, 0, 255));//青 pixels.show(); // This sends the updated pixel color to the hardware. delay(s); // Delay for a period of time (in milliseconds). int t = 150; kesu(); delay(t); gorin(); delay(t); kesu(); delay(t); gorin(); delay(t); kesu(); delay(t); gorin(); delay(1000); kesu(); delay(1000); }