Good morning to everyone,
I'm doing a university project related to CDMA signal encoding and decoding (bit sequence writing /reading in general).
Encoded signal is produced by an Arduino (Arduino 1) using digitalWrite and decoding is done by another Arduino (Arduino 2) using analogRead.
First problem : I have to use two Arduinos because Arduino 1 has to continuously produce signal (CONSTRAINT), so it cannot stop to acquire the encoded signal with analogRead.
Therefore the problem is that Arduino 2 can't stop running to acquire signal from Arduino 1 (I cannot stop Arduino 1 to communicate with Arduino 2)
Second problem (connected to first one): Is there a compact and more elegant way to merge the 2 codes or sketches!?
I would like to use one sketch or one IDE in order to have a portable/user-friendly interface.
I mean, if you look at analogRead, it does four things;
It sets up the input mix
It starts the conversion
It busy-waits on conversion complete
It reads and returns the result.
You can skip the busy-wait,if you write your own code.
I've already done it. I set up the prescale factor to 16 using the ADC registers (125 KHz sampling rate), while the encoded signal of Arduino 1 is tens of KHz fast. This should be enough.
The problem is that I want to control both the two Arduinos with the same code or interface. Is that possible?
Suggests you don't want to combine 2 sketches into one, you want to put the same sketch on 2 (or more) Arduinos. Of course you can do this, just program one, disconnect it, connect the second one and program that with the same code.