diff --git a/README.md b/README.md index 1e3ad70..237f38e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ - No need to change checkboxes, only paste the URL and hit OK. 4. Install **Raspberry Pi Pico** boards ([HowTo install boards](https://support.arduino.cc/hc/en-us/articles/360016119519-Add-boards-to-Arduino-IDE)) 5. Install libraries ([HowTo install libraries](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-installing-a-library/)): Adafruit Neopixel, AS5600 (Rob Tillaart), TCA9555 (Rob Tillaart) -6. Choose **Generic RP2350** as board and the correct port +6. Choose **Generic RP2350** as board and the correct port (Mac: /dev/cu.usbmodemXXXX, PC: COMXX Serial Port) 7. Go to **Tools -> Flash Size** and choose **16MB (no FS)** -8. Hit Upload Button +8. Make your changes in the code +9. Hit Upload Button (Arduino IDE compiles and uploads it automatically) diff --git a/soundcube-firmware/soundcube-firmware.ino b/soundcube-firmware/soundcube-firmware.ino index 693b52f..41331c5 100644 --- a/soundcube-firmware/soundcube-firmware.ino +++ b/soundcube-firmware/soundcube-firmware.ino @@ -124,10 +124,12 @@ void loop() { // Serial.println(ENC.getRevolutions()); // } + // LED Ring leeren for (int i = 0; i < 48; i++) { ui_pixels.setPixelColor(i + 3, edge_pixels.Color(0, 0, 0)); } + // flag = true when a button is pushed if (flag) { int val = TCA.read16(); Serial.println(val, BIN); @@ -143,6 +145,7 @@ void loop() { if (HAPTIC) { digitalWrite(6, HIGH); } + // Make beep if (AURAL) { digitalWrite(7, HIGH); click = true; @@ -150,19 +153,21 @@ void loop() { click = false; digitalWrite(7, LOW); } + // Make vibration if(HAPTIC){ if(!AURAL) delay(50); digitalWrite(6, LOW); } + // Flash led ring for (int i = 0; i < 48; i++) { ui_pixels.setPixelColor(i + 3, edge_pixels.Color(0, 15, 0)); } + // Switch through LED matrix if(buttons[RIGHT]) active++; if(buttons[LEFT]) active--; if(active == 13) active = 0; if(active == -1) active = 12; } - // 11111110 11111111 button right // EDGE LEDs for (int i = 0; i < 8; i++) { @@ -174,18 +179,22 @@ void loop() { ui_pixels.setPixelColor(1, edge_pixels.Color(0, 0, 15)); ui_pixels.setPixelColor(2, edge_pixels.Color(0, 0, 15)); + // empty LED matrix for (int i = 0; i < 13; i++) { ui_pixels.setPixelColor(i + 3 + 48 + 4, edge_pixels.Color(0, 0, 0)); } + // set active LED matrix LED ui_pixels.setPixelColor(active + 3 + 48 + 4, edge_pixels.Color(255, 255, 255)); - active_led_ring = abs((position / 256) % 48); + if(position < 0) position += 4096; + active_led_ring = (position / 32) % 48; + + // set active LED ring LED ui_pixels.setPixelColor(active_led_ring + 3, edge_pixels.Color(255, 255, 255)); - // put your main code here, to run repeatedly: - edge_pixels.show(); // Set all pixel colors to 'off' - ui_pixels.show(); // Set all pixel colors to 'off' + edge_pixels.show(); + ui_pixels.show(); - delay(1); + delay(1); // wait 1ms } \ No newline at end of file