Go Down

Topic: Communication between 2 boards (Read 551 times) previous topic - next topic

Poulet67

Hello everyone! I am very new to arduino and don't have much experience programming, but I have a decent familiarity with circuits and electronics.

What I am trying to accomplish is pretty simple: I just want one board to read the value of a pot, then send this value to a different arduino board, which will determine the brighness of an LED.

I can get the pot value fine with no problems, but I have been having trouble getting the 2 boards to communicate.

I figured (probably mistakenly) that I could just use the Serial.write and Serial.read commands, but it gives an error every time I upload it.

If anyone has any advice or tips that would be helpful.

Once again I am quite new to this, so thanks for your patience.

FabioZaZa

Why would you have problems with Serial.write() and Serial.read() ?

what you should perhaps do is have sortof the following:

char readVal;

while (!Serial.available());
readBal = Serial.read();

The while loop would keep the code in that position until a value has been received, also perhaps note what values have been sent as it could be sent as ASCII and not as just the number so you might need to subtract "0" from it....

I have recantly found the read String on the web but havent tried it out yet as the above would only read one character so you might need to string them together to receive multiple characters...

Hope this helps at all
:)

Grumpy_Mike

Quote
but it gives an error every time I upload it


You have to disconnect the serial connections between the arduinos when you up load a sketch. This is because the system uses the same pins to communicate as you are trying to use.

Go Up