Difference between revisions of "LilyPad Xbee"
(→Example code) |
(→Example code) |
||
Line 22: | Line 22: | ||
− | + | === instruction: === | |
+ | The code tested successfullly by Arduino 1.0 IDE | ||
+ | |||
* BlueTooth module-------Aduino Board | * BlueTooth module-------Aduino Board | ||
* Tx0 -------Rx | * Tx0 -------Rx |
Revision as of 04:27, 22 May 2014
Contents
Introduction
The LilyPad Bee is a radio transceiver that you can sew on to your clothing to create wearables or toy control or anywhere you want you to .The LilyPad Bee supply two power interface, one is 5V and the other is 3.3V,so you have more choices to select power supply .There is a communication interface that you can use to control other devices via serial port(In fact ,the following example code is just tested by this serial port source)
Features
Power supply:3.3V or 5V.If you have a power device who supplies 2V to 6V ,you should connect to “+” not the “3.3V” interface ,if the power is 3.3v you can connect to 3.3V interface directly. Frequency :The frequency reaches up to 2.4GHZ Current Limiting Protection
FAQ
Q1:How to judge the LilyPad Bee connect to power exactly? A:When the LilyPad Bee connect to power exactly , the “PWR” LED is on and “STATE” LED is flashing; Q:How to judge the LilyPad Bee connect to mobile Bluetooth software? A:When the LilyPad Bee connect to mobile Bluetooth software ,the “STATE” LED is on not flash.
Example code
instruction:
The code tested successfullly by Arduino 1.0 IDE
- BlueTooth module-------Aduino Board
- Tx0 -------Rx
- RXI -------TX
- GND -------GND
- 3.3V(+) -------3.3V(5V)
const int ledPin=13;//pin the led is connected to
int blinkread=0; //blink rate stored in this variable
void setup()
{
Serial.begin(9600);//initialize serial port to send and receive at 9600 baud pinMode(ledPin,OUTPUT);//set this pin sa output
} void loop() {
blink();
}
void serialEvent(void) {
while(Serial.available()) { char ch=Serial.read(); //is this an ascii digit between 0 and 9?the data's type received from //Mobile phone bluetooth serial port is String tpye if(isDigit(ch)) { blinkread=ch-'0';//ascii value converted to numeric value blinkread*=100; //actual rate is 100ms times received digit } }
} //blink the LED with the on and off times determined by blinkrate void blink() {
digitalWrite(ledPin,HIGH); delay(blinkread); digitalWrite(ledPin,LOW); delay(blinkread);
}
Notes
Pin layout is similar but not the same as the pin layout on the Bee. Certain pins have swapped to make sewing easier in projects that use the Arduino ,which has a different pin arrangement from the Bee;
Label Description
Label Description Bee Pin 3.3V connect regulated power only, nominally limited to 3.4 Volts 1 — ground 10 rx data in 2 tx data out 3 d08 digital output 8 (not supported yet) 4 rst reset 5 rssi received signal strength indicator / PWM output 0 6 pw1 PWM (pulse-width modulation) output 1 7 nc no connection 8 slp Sleep / digital input 8 / DTR 9 + connect unregulated Voltage here — ground (alternate connection) 10 d4 analog input 4 / digital input/output 4 11 d7 digital input/output 7 / CTS 12 on ON light output 13 vrf Voltage Reference for analog / digital inputs 14 asc association light output / analog input 5 / digital i/o 5 15 d6 analog input 6 / digital i/o 6 / RTS 16 d3 analog input 3 / digital i/o 3 17 d2 analog input 2 / digital i/o 2 18 d1 analog input 1 / digital i/o 1 19 d0 analog input 0 / digital i/o 0 20
How to buy
Click here to buy