From 17642f5c51e74f67869f2b562c4945f9322dc770 Mon Sep 17 00:00:00 2001 From: mintey Date: Fri, 26 Feb 2021 23:13:24 +0200 Subject: [PATCH] button testing --- smol_gkos.ino | 69 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/smol_gkos.ino b/smol_gkos.ino index c7a381c..7dde095 100644 --- a/smol_gkos.ino +++ b/smol_gkos.ino @@ -7,8 +7,8 @@ const int PIN_F = 26; const int PIN_MOUSE_UL = 27; const int PIN_MOUSE_UR = 30; -const int PIN_MOUSE_DL = 29; -const int PIN_MOUSE_DR = 28; +const int PIN_MOUSE_DL = 28; +const int PIN_MOUSE_DR = 29; const int PIN_LED1 = 6; const int PIN_LED2 = 1; @@ -18,10 +18,71 @@ const int PIN_BALL_SDA = 18; const int PIN_BALL_SCL = 19; const int PIN_BALL_INT = 11; +bool button_a = false; +bool button_b = false; +bool button_c = false; +bool button_d = false; +bool button_e = false; +bool button_f = false; + +bool button_mouse_ul = false; +bool button_mouse_ur = false; +bool button_mouse_dl = false; +bool button_mouse_dr = false; + void setup() { - + pinMode(PIN_A, INPUT_PULLUP); + pinMode(PIN_B, INPUT_PULLUP); + pinMode(PIN_C, INPUT_PULLUP); + pinMode(PIN_D, INPUT_PULLUP); + pinMode(PIN_E, INPUT_PULLUP); + pinMode(PIN_F, INPUT_PULLUP); + + pinMode(PIN_MOUSE_UL, INPUT_PULLUP); + pinMode(PIN_MOUSE_UR, INPUT_PULLUP); + pinMode(PIN_MOUSE_DL, INPUT_PULLUP); + pinMode(PIN_MOUSE_DR, INPUT_PULLUP); + + pinMode(PIN_LED1, OUTPUT); + pinMode(PIN_LED2, OUTPUT); + pinMode(PIN_LED3, OUTPUT); + + Serial.begin(115200); + Serial.println("helo"); } void loop() { - + button_a = digitalRead(PIN_A); + button_b = digitalRead(PIN_B); + button_c = digitalRead(PIN_C); + button_d = digitalRead(PIN_D); + button_e = digitalRead(PIN_E); + button_f = digitalRead(PIN_F); + + button_mouse_ul = digitalRead(PIN_MOUSE_UL); + button_mouse_ur = digitalRead(PIN_MOUSE_UR); + button_mouse_dl = digitalRead(PIN_MOUSE_DL); + button_mouse_dr = digitalRead(PIN_MOUSE_DR); + + Serial.print(button_a); + Serial.print(','); + Serial.print(button_b); + Serial.print(','); + Serial.print(button_c); + Serial.print(','); + Serial.print(button_d); + Serial.print(','); + Serial.print(button_e); + Serial.print(','); + Serial.print(button_f); + Serial.print(" - "); + Serial.print(button_mouse_ul); + Serial.print(','); + Serial.print(button_mouse_ur); + Serial.print(','); + Serial.print(button_mouse_dl); + Serial.print(','); + Serial.println(button_mouse_dr); + + delay(250); }