Skip to content

Commit c2d573d

Browse files
committed
Fixed voltage sensor algorithm. (#182)
1 parent 258837b commit c2d573d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/VoltageSensor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ VoltageSensor::VoltageSensor(int *const pins) : Device<float>(pins) {}
44

55
void VoltageSensor::initialize() { pinMode(_pins[0], INPUT); }
66

7-
float VoltageSensor::read() { return int(((float) analogRead(_pins[0]) / 4.092)) % 100 / 10; }
7+
float VoltageSensor::read() { return (float) analogRead(_pins[0]) * 5 / 1023; }

0 commit comments

Comments
 (0)