Serial output for debugging
This commit is contained in:
@@ -36,6 +36,8 @@ int value = 60; // 0-255
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
pinMode(CLK,INPUT);
|
||||
pinMode(DT,INPUT);
|
||||
pinMode(SW, INPUT_PULLUP);
|
||||
@@ -46,6 +48,8 @@ void setup() {
|
||||
pixels.begin(); // initialize NeoPixel library.
|
||||
pixels.fill(pixels.gamma32(pixels.ColorHSV(hue, saturation, value)), 0, NUMPIXELS);
|
||||
pixels.show();
|
||||
|
||||
Serial.println("PIXELS");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@@ -57,6 +61,7 @@ void loop() {
|
||||
btnState = digitalRead(SW);
|
||||
|
||||
if (digitalRead(DT) != currentStateCLK) {
|
||||
currentDir ="CW";
|
||||
if (btnState == LOW) {
|
||||
hue += HUE_STEP;
|
||||
if (hue > 65535) {
|
||||
@@ -74,6 +79,7 @@ void loop() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentDir ="CCW";
|
||||
if (btnState == LOW) {
|
||||
hue -= HUE_STEP;
|
||||
if (hue < 0) {
|
||||
@@ -92,6 +98,15 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
Serial.print("Direction: ");
|
||||
Serial.print(currentDir);
|
||||
Serial.print(" | Hue: ");
|
||||
Serial.print(hue);
|
||||
Serial.print(" | Sat: ");
|
||||
Serial.print(saturation);
|
||||
Serial.print(" | Val: ");
|
||||
Serial.println(value);
|
||||
|
||||
pixels.fill(pixels.gamma32(pixels.ColorHSV(hue, saturation, value)), 0, NUMPIXELS);
|
||||
pixels.show();
|
||||
}
|
||||
@@ -99,6 +114,7 @@ void loop() {
|
||||
btnState = digitalRead(SW2);
|
||||
|
||||
if (digitalRead(DT2) != currentStateCLK2) {
|
||||
currentDir ="CW";
|
||||
if (btnState == LOW) {
|
||||
hue += HUE_STEP;
|
||||
if (hue > 65535) {
|
||||
@@ -116,6 +132,7 @@ void loop() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currentDir ="CCW";
|
||||
if (btnState == LOW) {
|
||||
hue -= HUE_STEP;
|
||||
if (hue < 0) {
|
||||
@@ -134,6 +151,17 @@ void loop() {
|
||||
}
|
||||
}
|
||||
|
||||
Serial.print("Direction 2: ");
|
||||
Serial.print(currentDir);
|
||||
Serial.print(" | Button State: ");
|
||||
Serial.print(btnState);
|
||||
Serial.print(" | Hue: ");
|
||||
Serial.print(hue);
|
||||
Serial.print(" | Sat: ");
|
||||
Serial.print(saturation);
|
||||
Serial.print(" | Val: ");
|
||||
Serial.println(value);
|
||||
|
||||
pixels.fill(pixels.gamma32(pixels.ColorHSV(hue, saturation, value)), 0, NUMPIXELS);
|
||||
pixels.show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user