Serial mode operates at 9600 baud and works similar to serial mode on the US-100 module. The main difference is that it also returns a start byte and checksum byte. It also can be operated in an automatic mode of operation where the module is automatically triggered every 100mS.
The way Serial mode works is as follows:
The module is normally idle.
A command bye of 0x55 on the RX pin initiates a detection cycle.
The module responds with 4 bytes of information
Start bye of 0xFF
Most Significant Byte (MSB)
Least Significant Byte (LSB)
Checksum Byte
The returned value can be calculated using the formula (MSB * 256) + LSB.
The checksum byte is calculated using 0xFF + MSB + LSB. It returns the least significant byte of the calculation only.
It seems, that ptvo uses just the first two bytes, that is 255 and MSB and does not read the rest.
Serial mode operates at 9600 baud and works similar to serial mode on the US-100 module. The main difference is that it also returns a start byte and checksum byte. It also can be operated in an automatic mode of operation where the module is automatically triggered every 100mS.
The way Serial mode works is as follows:
The module is normally idle. A command bye of 0x55 on the RX pin initiates a detection cycle. The module responds with 4 bytes of information Start bye of 0xFF Most Significant Byte (MSB) Least Significant Byte (LSB) Checksum Byte
The returned value can be calculated using the formula (MSB * 256) + LSB.
The checksum byte is calculated using 0xFF + MSB + LSB. It returns the least significant byte of the calculation only.
It seems, that ptvo uses just the first two bytes, that is 255 and MSB and does not read the rest.