From 69f1cba2f8b15448f7da078090be23ae7068338f Mon Sep 17 00:00:00 2001 From: C0d3v Date: Mon, 19 Jan 2026 21:38:04 +0100 Subject: [PATCH] Add potiNano Code --- terminal/puzzle_colorFade/potiNano/.gitignore | 5 ++++ .../puzzle_colorFade/potiNano/platformio.ini | 14 ++++++++++ .../puzzle_colorFade/potiNano/src/main.cpp | 28 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 terminal/puzzle_colorFade/potiNano/.gitignore create mode 100644 terminal/puzzle_colorFade/potiNano/platformio.ini create mode 100644 terminal/puzzle_colorFade/potiNano/src/main.cpp diff --git a/terminal/puzzle_colorFade/potiNano/.gitignore b/terminal/puzzle_colorFade/potiNano/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/terminal/puzzle_colorFade/potiNano/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/terminal/puzzle_colorFade/potiNano/platformio.ini b/terminal/puzzle_colorFade/potiNano/platformio.ini new file mode 100644 index 0000000..8ba220f --- /dev/null +++ b/terminal/puzzle_colorFade/potiNano/platformio.ini @@ -0,0 +1,14 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:nanoatmega328new] +platform = atmelavr +board = nanoatmega328new +framework = arduino diff --git a/terminal/puzzle_colorFade/potiNano/src/main.cpp b/terminal/puzzle_colorFade/potiNano/src/main.cpp new file mode 100644 index 0000000..ca9be32 --- /dev/null +++ b/terminal/puzzle_colorFade/potiNano/src/main.cpp @@ -0,0 +1,28 @@ +#include + +#include + +#define I2C_SLAVE_ADDRESS 0x08 + +uint16_t values[6] = {0}; + +void onI2CRequest() { + Wire.write((uint8_t*)values, sizeof(values)); +} + +void setup() { + Wire.begin(I2C_SLAVE_ADDRESS); + Wire.onRequest(onI2CRequest); + + analogReference(DEFAULT); +} + +void loop() { + values[0] = analogRead(A0); + values[1] = analogRead(A1); + values[2] = analogRead(A2); + + values[3] = analogRead(A3); + values[4] = analogRead(A6); + values[5] = analogRead(A7); +} \ No newline at end of file