-->
Page 1 of 1

Hex via serial

PostPosted: Sun Oct 20, 2019 12:40 pm
by Scugnizzo
Hi all,
I was wondering to drive a mini DF player with a wemos via serial. The df player uses sequences of hex data to perform various actions. For example, to play the song 1 I will send 7E FF 06 03 00 00 01 FE F7 EF. I have made several tests with no results. It's possible to do this? Thanks

Re: Hex via serial

PostPosted: Tue Oct 22, 2019 5:35 am
by Scugnizzo
UPDATE. tried to drive df player via PC with realterm and usb to TTL adapter. Works fine! But with wemos NOTHING happens.
Code: Select allmemclear
baudrate 9600
serialflush
button "Play",[play]
button "End", [fine]

[loop]
wait

[play]
serialprint chr(126) & chr(255) & chr(6) & chr(3) & chr(0) & chr(0) & chr(1)
serialprint chr(254) & chr(247) & chr(239)
goto [loop]

[fine]
end

Any suggestion?
Thanks

Re: Hex via serial SOLVED

PostPosted: Wed Oct 23, 2019 1:09 am
by Scugnizzo
Finally it works!
I have tested wemos output (with serial2) on realterm. I don't know why, but you need to split the serial2print data in two different rows otherwise you'll receive a bad output.
Code: Select all
[play]
serialprint chr(126) & chr(255) & chr(6) & chr(3) & chr(0) & chr(0) & chr(1)
serialprint chr(254) & chr(247) & chr(239

This code will output :
7E FF 06 03 00 00 :shock: 00 :shock: FE F7 EF but if you move the last chr(1) on the first row at the start of the second row the output will be correctly
7E FF 06 03 00 00 01 FE F7 EF
and the df player will start to play the first song.
Bye