Skip to content

Instantly share code, notes, and snippets.

@NapapornSantong
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NapapornSantong/cb8432cde72ca1dc40dc to your computer and use it in GitHub Desktop.
Save NapapornSantong/cb8432cde72ca1dc40dc to your computer and use it in GitHub Desktop.
#include <NeoPixelBus.h>
#define pixelCount 1
#define colorSaturation 128
NeoPixelBus strip = NeoPixelBus(pixelCount, 5);
RgbColor red = RgbColor(255);
RgbColor Low = RgbColor(0, 0, 0);
void setup() {
// put your setup code here, to run once:
pinMode(4,INPUT);
Serial.begin(115200);
delay(50);
strip.Begin();
strip.Show();
}
void loop() {
if(digitalRead(4) == 1)
{
Serial.println("ooooooooooooooooooooooooooooooooooo");
strip.SetPixelColor(0,red);
strip.Show();
}
else
{
Serial.println("ooooooooooooo");
strip.SetPixelColor(0,Low);
strip.Show();
}
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment