Update controller to use internal pullup
This commit is contained in:
parent
db4232f94d
commit
4c0a54dc4a
|
@ -0,0 +1,3 @@
|
|||
# Yasaka Kanako
|
||||
|
||||
This cosplay won a Judge's favourite award at TouhouFest 2025.
|
|
@ -1,7 +1,8 @@
|
|||
#define USE_MOTOR 1
|
||||
#define USE_LED 1
|
||||
#define USE_DISPLAY 1
|
||||
#define USE_DISPLAY 0
|
||||
|
||||
// The mode switch button should be wired to the ground with an internal pullup resistor.
|
||||
#define pinButtonMode 9
|
||||
#define pinDiag 6
|
||||
|
||||
|
@ -52,7 +53,7 @@ bool flag_lighting = false;
|
|||
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
pinMode(pinButtonMode, INPUT);
|
||||
pinMode(pinButtonMode, INPUT_PULLUP);
|
||||
#if USE_LED
|
||||
// Calculate colours
|
||||
hsv2rgb_spectrum(CHSV(4, 255, 100), color_red);
|
||||
|
@ -71,6 +72,8 @@ void setup() {
|
|||
fill_solid(leds, NUM_LEDS, CRGB::White);
|
||||
delay(500);
|
||||
FastLED.show();
|
||||
fill_solid(leds, NUM_LEDS, CRGB::Black);
|
||||
delay(500);
|
||||
#endif
|
||||
#if USE_DISPLAY
|
||||
Serial.begin(9600);
|
||||
|
@ -87,7 +90,7 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
// Detect a rising edge
|
||||
int buttonState = digitalRead(pinButtonMode);
|
||||
int buttonState = !digitalRead(pinButtonMode);
|
||||
if (buttonState && !stateButtonMode) {
|
||||
programId = (programId + 1) % MAX_PROGRAMS;
|
||||
programChanged = true;
|
||||
|
|
Loading…
Reference in New Issue