Skip to content

Instantly share code, notes, and snippets.

@MichMich
Created January 27, 2017 08:11
Show Gist options
  • Save MichMich/f74bfe2fed4c2228853ede50e723ff9f to your computer and use it in GitHub Desktop.
Save MichMich/f74bfe2fed4c2228853ede50e723ff9f to your computer and use it in GitHub Desktop.
Arcade Neopixel Button
#include <Arduino.h>
#include <FastLED.h>
#define LED_PIN 7
#define BUTTON_PIN 8
CRGB leds[1];
void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, 1);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
static uint8_t hue = 0;
static uint8_t targetHue = 0;
FastLED.showColor(CHSV(targetHue, 255, 255));
if (targetHue != hue) targetHue++;
delay(2);
if (!digitalRead(BUTTON_PIN)) {
hue += 8;
delay(20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment