-
-
Save ug23/71171451f582615589ef4d4302f46a46 to your computer and use it in GitHub Desktop.
レインボーキンブレ用ソース
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ほとんどすべてをNeopixelのサンプルから拝借 | |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
// 入力するdigital ioのピン | |
#define LED_PIN 6 | |
// テープ上の個数。過不足あると不自然なレインボーになる | |
#define LED_COUNT 8 | |
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); | |
void setup() { | |
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) | |
clock_prescale_set(clock_div_1); | |
#endif | |
strip.begin(); | |
strip.show(); | |
// 明るさ 0 〜 255 | |
strip.setBrightness(255); | |
} | |
void loop() { | |
rainbow(5); | |
} | |
void rainbow(int wait) { | |
for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) { | |
strip.rainbow(firstPixelHue); | |
strip.show(); | |
delay(wait); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment