From 08efd15d2486c078f9180e34e1b91d3a455f417c Mon Sep 17 00:00:00 2001 From: smayzy Date: Sat, 2 May 2026 00:10:41 +0200 Subject: [PATCH] init cocomobile-arduino --- cocomobile-arduino/cocomobile-arduino.ino | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cocomobile-arduino/cocomobile-arduino.ino diff --git a/cocomobile-arduino/cocomobile-arduino.ino b/cocomobile-arduino/cocomobile-arduino.ino new file mode 100644 index 0000000..1ea0cfc --- /dev/null +++ b/cocomobile-arduino/cocomobile-arduino.ino @@ -0,0 +1,25 @@ +#include +const float TENSION_SCALE = 15.701; +const float CURRENT_SCALE = 27.322; +const float ADC_TO_VOLT = 5.0 / 1023.0; + +SoftwareSerial lora(8, 9); // RX, TX + +float tens = 0; +float amp = 0; + +void setup() { + lora.begin(9600); + Serial.begin(115200); +} + +void loop() { + tens = (analogRead(A1) * ADC_TO_VOLT * TENSION_SCALE); + amp = (analogRead(A0) * ADC_TO_VOLT * CURRENT_SCALE); + + Serial.print(tens); + Serial.print(","); + Serial.println(amp); + + lora.println(); +} \ No newline at end of file