I’m new to Arduino (and crap, I love these things) and I’m wanting to start working towards more communication apps. With that said, I’m starting with GUI’s ( http://lab.guilhermemartins.net/?p=346 ) example on adjusting an LED’s brightness on the “receive” board by adjusting a pot on the “send” side. So I hooked up the boards as instructed and nothing’s happening. So I tried a loop back on RX/TX on the send board and found (via the serial monitor) that it’s outputting “junk” no matter what baud rate I set. The code is as follows…
Sender:
int analogValue5, val5;
void setup() {
// abertura da porta Serial
Serial.begin(19200);
}
void loop() {
// leitura do pin analógico 5
analogValue5 = analogRead(5);
// remapear valores para 0 / 255
val5 = map(analogValue5, 0, 1023, 0, 255);
// enviar valores para porta Serial
Serial.println(val5, BYTE);
}
// RECIEVER
byte incomingByte;
void setup() {
// abertura da porta Serial
Serial.begin(19200);
// declarar pin 11 como output, aqui está o LED
pinMode (11, OUTPUT);
}
void loop() {
// se houver bytes a entrar na porta serial
if (Serial.available()) {
// atribuir valores à variavel ‘incomingByte’
incomingByte = Serial.read();
// escreve valor no pin 11
analogWrite(11, int(incomingByte));
}
}
Does anyone see what’s wacky. This rookie appreciates the help…