Evening,
I'm working on a university project which is sending data using LASER as our medium. The description of the project is that we have 2 arduino's one for sending and other for receiving, we are sending 8 bit array and have tested and used oscilloscope to make sure our signal is sent and received correctly. We are receiving the bits by using a mechanism of interrupts: start interrupt to detect the start bit which is a falling edge in our case, and a counter that interrupts the first time after 150ms and then interrupts at every 100ms to read the bits (we are sending the bits at 100ms), the idea from this is creating something similar to UART protocol.
So far our signal is being sent and received just fine, our start interrupt is being initiated and 8 interrupts from the counter are also happening this happens ofcourse when we send our array from the sender LASER.
Our problem is that we are not able to read the bits sent correctly.
volatile uint8_t a[8];
if( i < 8 ){
a = digitalRead(DATA);
- i++;*
- Serial.print("Interrupt executed \n");*
_ Serial.print(a );_
This is the chunk of code we are using to read the signal but we are not getting the right output.
The output we get is 00000008 for some reason we are sending 00110010. We are still trying to use different techniques to read the bits but we are kinda of beginners.
Any help, suggestions or tips are very much appreciated. Thank you.