'how to get pH in Java using Grove - PH Sensor Kit (E-201C-Blue) Raspberry pi Zero and GrovePi Zero Board
I have GrovePi Zero(GrovePi0) from GrovePi Zero Base Kit and Grove - PH Sensor Kit (E-201C-Blue) I am using Java (I can use any version of JDK 8...17) on a Raspberry Pi Zerro 2. with GrovePi-pi4j with Pi4j version 1.4 (can use any version)
my class GrovePHSensor below represents the PH Sensor.
@GroveAnalogPin
public class GrovePHSensor extends GroveAnalogInputDevice<Double> {
public GrovePHSensor(GrovePi grovePi, int pin) throws IOException {
super(grovePi.getAnalogIn(pin, 4));
}
@Override
public Double get(byte[] data) {
/// WHAT TO DO HERE?
}
}
the problem is that there are tons of strange code out there that give different result and even if I think that I understand what it does I am not sure if it the right thing to do.
for example the this thread is very confusing https://forum.dexterindustries.com/t/grove-ph-sensor-kit-e-201c-blue-raspberry-pi-zero/7961/13
at the same time wiki page at Seeed https://wiki.seeedstudio.com/Grove-PH-Sensor-kit/ gives a sample code for Arduino with different formula
when I read the 4 byte[] i get something like [Pi4J IO read][0, 1, -106, -1] if i read more than 4 bytes than all the bytes at the end are -1
would be nice to have a clear implementation of the public Double get(byte[] data) {}
function ...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|