2019-04-13 10:34:36 +02:00
|
|
|
#include <NeoPixelBus.h>
|
|
|
|
|
|
|
|
#define WS_PIN 2 // On Trinket or Gemma, suggest changing this to 1
|
2019-06-15 12:52:45 +02:00
|
|
|
#define NUMPIXELS 113 // 113=UNHB Popular NeoPixel ring size
|
2019-04-13 10:34:36 +02:00
|
|
|
#define TOUCH_PIN 4 //Für Touch: 2, 4, 12, 13, 14, 15, 27
|
|
|
|
|
2019-06-15 12:52:45 +02:00
|
|
|
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(NUMPIXELS, WS_PIN);
|
2019-04-11 19:16:59 +02:00
|
|
|
|
|
|
|
int touch_value = 100;
|
2019-04-13 10:34:36 +02:00
|
|
|
int i = 0;
|
|
|
|
int d = 1;
|
2019-04-11 19:16:59 +02:00
|
|
|
|
2019-06-15 12:52:45 +02:00
|
|
|
RgbColor black(0);
|
|
|
|
RgbColor white(255);
|
|
|
|
RgbColor farbe;
|
2019-04-13 10:34:36 +02:00
|
|
|
|
|
|
|
void setup() {
|
2019-04-11 19:16:59 +02:00
|
|
|
Serial.begin(115200);
|
2019-06-15 12:52:45 +02:00
|
|
|
//Serial.println("Touch Test");
|
2019-04-13 10:34:36 +02:00
|
|
|
|
2019-06-15 12:52:45 +02:00
|
|
|
//Serial.println("Switching off all LEDs");
|
2019-04-13 10:34:36 +02:00
|
|
|
strip.Begin();
|
|
|
|
//strip.SetBrightness(128);
|
|
|
|
strip.ClearTo(black);
|
|
|
|
strip.Show();
|
2019-04-11 19:16:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop(){
|
|
|
|
touch_value = touchRead(TOUCH_PIN);
|
2019-04-13 10:34:36 +02:00
|
|
|
|
2019-06-15 12:52:45 +02:00
|
|
|
if ( (touch_value>42) && (touch_value < 47)) {
|
|
|
|
Serial.print("Touch @ ");
|
|
|
|
Serial.println(touch_value);
|
2019-04-13 10:34:36 +02:00
|
|
|
i+=d;
|
|
|
|
}
|
2019-04-13 15:19:17 +02:00
|
|
|
//Serial.println(touch_value);
|
|
|
|
//Serial.println(i);
|
2019-04-13 10:34:36 +02:00
|
|
|
strip.ClearTo(black);
|
|
|
|
strip.SetPixelColor(i, white);
|
|
|
|
strip.Show();
|
|
|
|
|
2019-04-13 15:19:17 +02:00
|
|
|
if(i>=NUMPIXELS ) { d=(-1); }
|
|
|
|
if(i<=0 ) { d=1; }
|
2019-06-15 12:52:45 +02:00
|
|
|
//delay(10);
|
2019-04-11 19:16:59 +02:00
|
|
|
}
|