ieee488:
The battery voltage is 1 byte.
One byte can be 0x00 (which is 0) to 0xff (which is 255).
When you write 10, do you mean 0000 1010 ?
When you write 250, do you mean 1111 1010 ?
Is your serial communication solid?
Do you have the baud rate, etc set up correctly?
Are you getting all 20 bytes?
Are the first 3 bytes PS4?
P = 0x50 = 0101 0000
S = 0x53 = 0101 0011
4 = 0x34 = 0011 0100
Good Morning,
Thanks for your answer, I have been doing tests ,,, I had always obtained the values with I2C, all the values were good except the battery that according to the page goes from 0 to 15, but I always had a problem and it was that I obtained values in a Range from 0 to 255, as you say, a byte goes from 0 to 255 ,,, but it is not something progressive, suddenly it is at 245 and drops to 12.
I have checked all the connections and the Serial baudrate was correct. Everything's fine.
Serial-Con-Puerto-SERIEBINARIO hosted at ImgBB — ImgBB -SERIAL BINARY TO CHAR
Serialcon-PUERTOSERIEHEX hosted at ImgBB — ImgBB -SERIAL HEX TO CHAR ,
I have tried to read the data by SERIAL HEXADECIMAL using the library, the result is the same, then I have read the data directly by binary without using any library, the result is the same, the values go from 0 to 255 ,,, then because the datasheet says that the value of the battery has to go from 0 to 15? Nor do I understand why they oscillate from one value to another without following a progression of battery wear.
Is this something that can be fixed or is it a value returned by the gamepad and has nothing to do with the module and data collection from arduino?
Thanks.