Our next task for Sociable Objects Workshop was to create a two-way interactive doorbell… so visitor knows that the buzzer has rung; also
a doorbell with a nap mode and; finally, any doorbell of our choosing.
A key mistake during initial set-up was rushing the process of soldering pins to my Breakout Board. When you’re doing this part, it’s very important to take your time and have a properly tuned soldering iron with grounded tip. The pins are each spaced 2 mm apart so precision and a steady hand are key as you can easily screw up your Breakout Board.
This was only the beginning of what took us several hours and multiple false starts. For some reason we couldn’t get our code to upload to the receiving buzzer part of the doorbell. After going through full-range of troubleshooting we were reminded to unplug TX and RX wires from the Arduino before uploading the code; this worked but still no feedback… we then decided to re-set the PAN ID to no avail. Rob mentioned a common problem here was that the radios needed to be taken out of Command mode by executing the ATCN command… this exits from set-up mode back to transparent mode… and then starting the process over again… this solved our problem. Code here:
/*
* ********* Doorbell Basic BELL ********
* requires pre-paired XBee Radios
* and the BUTTON program on the receiving end
* by Rob Faludi http://faludi.com
*/
#define VERSION ā1.00a0ā³
int BELL = 4;
void setup() {
pinMode(BELL, OUTPUT);
Serial.begin(9600);
}
void loop() {
// look for a capital D over the serial port and ring the bell if found
if (Serial.available() > 0) {
if (Serial.read() == āDā){
//ring the bell briefly
digitalWrite(BELL, HIGH);
delay(10);
digitalWrite(BELL, LOW);
}
}
}