set for hall sensor
This commit is contained in:
parent
ed049c234b
commit
d9f7332824
@ -1,6 +1,6 @@
|
|||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
const float TENSION_SCALE = 15.701;
|
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;
|
const float ADC_TO_VOLT = 5.0 / 1023.0;
|
||||||
|
|
||||||
SoftwareSerial lora(8, 9); // RX, TX
|
SoftwareSerial lora(8, 9); // RX, TX
|
||||||
@ -17,7 +17,9 @@ void setup() {
|
|||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
tens = (analogRead(A1) * ADC_TO_VOLT * TENSION_SCALE);
|
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(tens);
|
||||||
Serial.print(",");
|
Serial.print(",");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user