conversion of binary to string

i am doing a LIFI kinda project in which a string is converted into binary array and is transmitted .
if the Boolean value is 1 led will be ON for 50ms else if 0 its OFF for 50ms.
the transmitter is working properly. In the receiver i kept a photo diode which is connected anologe pin A0
and im able to receive the same binary data but i dont know how to convert it back to string.
if i receive 10000000 it should display -a
10000001 -b and so on.(ASCII encoding)
can u please help
Thank YOU

rx.ino (869 Bytes)

Step through the set of received data with a loop. bit write the value of data(i) to target(i).

rocky27:
if i receive 10000000 it should display -a
10000001 -b and so on.(ASCII encoding)

Your bits for 'a' and 'b' do not agree with the ASCII Codes as listed in the following Table:

GolamMostafa:
Your bits for 'a' and 'b' do not agree with the ASCII Codes as listed in the following Table:

ya sorry ,a -097-01100001 b-098-01100010 and so on.

dougp:
Step through the set of received data with a loop. bit write the value of data(i) to target(i).

can u plz give an example?

Try hooking the led up to TX of the sender and hook the detector to RX of the receiver and use Serial to handle the communications? Softserial should do the job fine, maybe start at 300 baud (300 bits, 30 bytes with a start and stop bit for each per second) to see if the detector is fast enough?

Just know that serial bits are HIGH for 0 and LOW for 1. The libraries and hardware handle that but if you go checking the light, it will be ON as the "carrier" (goes all the way back to telegraph) and all 0 bits.

You just want a straight conversion from 0x80 -> 'a', 0x81 -> 'b', etc.?
Then just mask off the MSB and add 0x61.