From e337c32ec48be9fb061674b62ed2e0c032b04f58 Mon Sep 17 00:00:00 2001 From: andrea Date: Sat, 4 Nov 2023 10:32:44 +0100 Subject: [PATCH] rename and prepare digital input --- {snake => snake_arduino}/Makefile | 2 +- snake/snake.ino => snake_arduino/snake_arduino.ino | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) rename {snake => snake_arduino}/Makefile (73%) rename snake/snake.ino => snake_arduino/snake_arduino.ino (91%) diff --git a/snake/Makefile b/snake_arduino/Makefile similarity index 73% rename from snake/Makefile rename to snake_arduino/Makefile index b223e2c..a1c0db0 100644 --- a/snake/Makefile +++ b/snake_arduino/Makefile @@ -1,5 +1,5 @@ compile: - arduino-cli compile -b arduino:renesas_uno:unor4wifi snake.ino + arduino-cli compile -b arduino:renesas_uno:unor4wifi ./snake_arduino.ino upload: arduino-cli upload -b arduino:renesas_uno:unor4wifi -p /dev/ttyACM0 diff --git a/snake/snake.ino b/snake_arduino/snake_arduino.ino similarity index 91% rename from snake/snake.ino rename to snake_arduino/snake_arduino.ino index 373949a..d5ba812 100644 --- a/snake/snake.ino +++ b/snake_arduino/snake_arduino.ino @@ -36,6 +36,14 @@ void setup() { Serial.begin(115200); // stard LED matrix matrix.begin(); + // btn up + pinMode(13, INPUT); + // btn right + pinMode(12, INPUT); + // btn bottom + pinMode(11, INPUT); + // btn left + pinMode(10, INPUT); } void move_snake() { @@ -83,6 +91,9 @@ void move_snake() { frame[snake_y[0]][snake_x[0]]= 1; } +void change_direction() { +} + void loop() { matrix.renderBitmap(frame, 8, 12); delay(300);