i want to send ascii data from pin 11 in arduino 1 to pin 12 in arduino 2 via IR. i use TSOP 1838 to receive data. i really don’t want to use Serial intruction for send and receive data like Serial.print(), Serial.available(), Serial.read(), etc. i only use Serial to show the result on my Serial monitor.
i use ASK modulation. so bit “0” is IR signal with 38khz frequency. and bit “1” is other signal. in this case i use continuous “1” signal.
i send ascii for “E” the binary is 0100 0101.
i send bit from LSB to MSB bit first, that is 1010 0010
i received LSB bit first. so i have to invert the sequence.
i use 300 bps data rate
and 9600 baud for show result to serial monitor.
the code is attached.
but i don’t receive data correctly.
in few time, even though no start bit, the recipient has stated that the bit has started. so data is broken etc.
other problem is i see in serial monitor that 3 bit “0”, interpreted as 4 bit “0” or “001”. etc.
help me find the wrong code or wrong timing.
Sender.ino (706 Bytes)
receiver.ino (1.51 KB)