Pages: [1]   Go Down
Author Topic: Using RX and TX pins.  (Read 385 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 22
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a mosaur transmitter reveiver pair and one arduino decillima for each.

I have been trying to get my transmitter-receiver pair working for a while and was having problems uploading sketches to my receiver board (some avrdude error).  I then relaized that if I remove the pin going into RX the board starts working (though not receiving signals).  So A little searching later and I found that adding a 10K resistor to the input into RX stops the board from stopping working.

Does this also stop the board from receiving signals?  Should the sending board also have a resistor somewhere?

Heres the code on my receiving board:
Code:
void setup() {

  // for a motor
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  
  //I am running a motor though an H-bridge, this starts the motor turning
  digitalWrite(2,  LOW);
  digitalWrite(3,  HIGH);
  
  Serial.begin(2400);
}

void loop() {
  
  //if we receive any signal
  if(Serial.available() > 0)
  {
    //consume the serial input so there is no more available
    Serial.read();
    
    //stop the motor for one second
    digitalWrite(2,  HIGH);
    delay(1000);
    digitalWrite(2,  LOW);
  }
}

With the above code the motor will run IF the RX wire is not connected or there is a 10K resistor on it.

And the code on my transmitting board:
Code:
void setup() {
  
  
  Serial.begin(2400);
}

void loop() {
  
  Serial.print(3);
  delay(5000);
}

I'm not sure if the above transmitter code is working, I am not sure how to debug it and have made it as simple as possible.

Thanks,
Pooh
« Last Edit: October 20, 2008, 11:36:39 pm by Poohshoes » Logged

Pages: [1]   Go Up
Jump to: