Go Down

Topic: How to use xbee or other thing base on TTL? (Read 806 times) previous topic - next topic

zixzixzix

Mar 01, 2014, 04:22 pm Last Edit: Mar 01, 2014, 04:32 pm by zixzixzix Reason: 1
I can ues my xbee on arduino uno very well.
but i canot use it on arduino yun for the same code.
Code: [Select]

 // Analog input pin that the potentiometer is attached to

        // value read from the pot
String val = "";     

void setup() {

  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  if(Serial.available()>0){
   
  
  val+= char(Serial.read());
  delay(100);
 
  Serial.println(val);
  Serial.flush();
  val="";
  }
}


PCWorxLA


I can ues my xbee on arduino uno very well.
but i canot use it on arduino yun for the same code
Common issue, your code uses the serial port of the Uno, that will not work on a Yun, as the serial port is used for the bridge between the two different parts (MIPS/AVR) of a Yun...

Ralf

zixzixzix


PCWorxLA


Thank you.
So I must use soft serial?
Yup, that's the most likely alternative...

Ralf

Go Up