Add potiNano Code

This commit is contained in:
C0d3v 2026-01-19 21:38:04 +01:00
parent e2bf85c91e
commit 69f1cba2f8
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

View File

@ -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

View File

@ -0,0 +1,28 @@
#include <Arduino.h>
#include <Wire.h>
#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);
}