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.
Why would you have problems with Serial.write() and Serial.read() ?
what you should perhaps do is have sortof the following:
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
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.