45 lines
957 B
C++
45 lines
957 B
C++
#include <NeoPixelBus.h>
|
|
|
|
#define WS_PIN 2 // On Trinket or Gemma, suggest changing this to 1
|
|
#define NUMPIXELS 113 // Popular NeoPixel ring size
|
|
#define TOUCH_PIN 4 //Für Touch: 2, 4, 12, 13, 14, 15, 27
|
|
|
|
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(NUMPIXELS, WS_PIN);
|
|
|
|
int touch_value = 100;
|
|
int i = 0;
|
|
int d = 1;
|
|
|
|
RgbwColor black(0);
|
|
RgbwColor white(255);
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
Serial.println("Touch Test");
|
|
|
|
Serial.println("Switching off all LEDs");
|
|
strip.Begin();
|
|
//strip.SetBrightness(128);
|
|
strip.ClearTo(black);
|
|
strip.Show();
|
|
}
|
|
|
|
void loop(){
|
|
touch_value = touchRead(TOUCH_PIN);
|
|
|
|
if ( (touch_value>10) && (touch_value < 50)) {
|
|
//Serial.print("Touch @ ");
|
|
Serial.print("@");
|
|
i+=d;
|
|
}
|
|
//Serial.println(touch_value);
|
|
//Serial.println(i);
|
|
strip.ClearTo(black);
|
|
strip.SetPixelColor(i, white);
|
|
strip.Show();
|
|
|
|
if(i>=NUMPIXELS ) { d=(-1); }
|
|
if(i<=0 ) { d=1; }
|
|
delay(10);
|
|
}
|