Quantcast
Channel: Seeedstudio Forum
Viewing all articles
Browse latest Browse all 6612

Bees Shield v2.12 & Seeeduino v3.0 not working

$
0
0
Hey man. i did not get help to when i asked about interfacing the xbee shield v2.0 with arduino. I ended up removing the jumpers and connecting any of the pins on the tx rail (xbee shield) to the rx of arduino and rx of rail to tx of arduino using male to female dupont cables. When communicating, there should be a red light on the receiving xbee or both if they are both talking together. I did not use the software serial library. here is the sample code i used to turn on a light switch from one arduino to another with xbee:

Transmitter
Code: This code is in the public domain.

*/

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
     
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);     
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    //transmit a High command to the pumpkin and delay a second so that it does not receive more than one command
    //per button press
    Serial.println('h');
    delay(1000);
  }
}




Receiver

Code: /Xbee receiver
//This example code is in the Public Domain

int sentDat;

void setup() {
  Serial.begin(9600);   
  pinMode(2, OUTPUT);
}

void loop() {
  if (Serial.available() > 0) {
   sentDat = Serial.read();

   if(sentDat == 'h'){
          //activate the pumpkin for one second and then stop
       digitalWrite(2, HIGH);
          delay(1000);
          digitalWrite(2, LOW);
   }
  }
}


If you need to interface multiple servos simultaneously give me a buzz! i used the Easy Transfer Library for that.

Statistics : Posted by mcgski • on Sat Jan 03, 2015 3:34 pm • Replies 2 • Views 227

Viewing all articles
Browse latest Browse all 6612

Trending Articles