Fixed memory leak, minor cleanups
This commit is contained in:
parent
86a739a0a4
commit
b40b413c3d
1 changed files with 10 additions and 9 deletions
|
@ -4,14 +4,14 @@
|
||||||
#define NUMPIXELS 113 // Popular NeoPixel ring size
|
#define NUMPIXELS 113 // Popular NeoPixel ring size
|
||||||
#define TOUCH_PIN 4 //Für Touch: 2, 4, 12, 13, 14, 15, 27
|
#define TOUCH_PIN 4 //Für Touch: 2, 4, 12, 13, 14, 15, 27
|
||||||
|
|
||||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(NUMPIXELS, WS_PIN);
|
NeoPixelBus<NeoGrbwFeature, Neo800KbpsMethod> strip(NUMPIXELS, WS_PIN);
|
||||||
|
|
||||||
int touch_value = 100;
|
int touch_value = 100;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int d = 1;
|
int d = 1;
|
||||||
|
|
||||||
RgbColor black(0);
|
RgbwColor black(0);
|
||||||
RgbColor white(255);
|
RgbwColor white(255);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
@ -27,17 +27,18 @@ void setup() {
|
||||||
void loop(){
|
void loop(){
|
||||||
touch_value = touchRead(TOUCH_PIN);
|
touch_value = touchRead(TOUCH_PIN);
|
||||||
|
|
||||||
if (touch_value < 50) {
|
if ( (touch_value>10) && (touch_value < 50)) {
|
||||||
Serial.print("Touch @ ");
|
//Serial.print("Touch @ ");
|
||||||
|
Serial.print("@");
|
||||||
i+=d;
|
i+=d;
|
||||||
}
|
}
|
||||||
Serial.println(touch_value);
|
//Serial.println(touch_value);
|
||||||
|
//Serial.println(i);
|
||||||
strip.ClearTo(black);
|
strip.ClearTo(black);
|
||||||
strip.SetPixelColor(i, white);
|
strip.SetPixelColor(i, white);
|
||||||
strip.Show();
|
strip.Show();
|
||||||
|
|
||||||
if(i==NUMPIXELS || i == 0) { d=d*(-1); }
|
if(i>=NUMPIXELS ) { d=(-1); }
|
||||||
|
if(i<=0 ) { d=1; }
|
||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue