init cocomobile-arduino

This commit is contained in:
smayzy 2026-05-02 00:10:41 +02:00
parent 18645354ad
commit 08efd15d24

View File

@ -0,0 +1,25 @@
#include <SoftwareSerial.h>
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();
}