Compare commits
4
Commits
ed049c234b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2adcf7afd | ||
|
|
446757cf88 | ||
|
|
b7fde78367 | ||
|
|
d9f7332824 |
@@ -1,23 +1,29 @@
|
||||
#include <SoftwareSerial.h>
|
||||
const float TENSION_SCALE = 15.701;
|
||||
const float CURRENT_SCALE = 27.322;
|
||||
const float CURRENT_SCALE = 31.25;
|
||||
const float ADC_TO_VOLT = 5.0 / 1023.0;
|
||||
|
||||
SoftwareSerial lora(8, 9); // RX, TX
|
||||
SoftwareSerial lora(10, 9); // RX, TX
|
||||
|
||||
float tens = 0;
|
||||
float amp = 0;
|
||||
|
||||
String line;
|
||||
String line = "";
|
||||
|
||||
void setup() {
|
||||
lora.begin(9600);
|
||||
Serial.begin(115200);
|
||||
pinMode(11, OUTPUT);
|
||||
pinMode(12, OUTPUT);
|
||||
digitalWrite(11, LOW); // M1
|
||||
digitalWrite(12, LOW); // M0
|
||||
}
|
||||
|
||||
void loop() {
|
||||
tens = (analogRead(A1) * ADC_TO_VOLT * TENSION_SCALE);
|
||||
amp = (analogRead(A0) * ADC_TO_VOLT * CURRENT_SCALE);
|
||||
amp = analogRead(A2);
|
||||
if (amp < 505) amp = 505;
|
||||
amp = (amp - 505) * ADC_TO_VOLT * CURRENT_SCALE;
|
||||
|
||||
Serial.print(tens);
|
||||
Serial.print(",");
|
||||
@@ -33,4 +39,5 @@ void loop() {
|
||||
line += c;
|
||||
}
|
||||
}
|
||||
delay(100);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
SoftwareSerial lora(8, 9); // RX, TX
|
||||
SoftwareSerial lora(10, 9); // RX, TX
|
||||
|
||||
bool test_with_fake = false;
|
||||
|
||||
String line;
|
||||
String line = "";
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
lora.begin(9600);
|
||||
pinMode(11, OUTPUT);
|
||||
pinMode(12, OUTPUT);
|
||||
digitalWrite(11, LOW); // M1
|
||||
digitalWrite(12, LOW); // M0
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Reference in New Issue
Block a user