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