This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
sparrow_v4_en [2015/10/08 17:18] dan.tudose [Sparrow Wireless Sensor Node] |
sparrow_v4_en [2016/11/03 16:34] (current) dan.tudose [Light Sensor] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Sparrow Wireless Sensor Node ====== | ====== Sparrow Wireless Sensor Node ====== | ||
| - | {{ :: | + | {{:sparrow_small.png?70 |}} |
| Sparrow is an excellent platform for IoT, ultra low-power wireless computing and energy harvesting, with state-of-the-art sensing capabilities. It was designed to work with a range of wireless protocols, including IEEE 802.15.4, 6LoWPAN and ZigBee. | Sparrow is an excellent platform for IoT, ultra low-power wireless computing and energy harvesting, with state-of-the-art sensing capabilities. It was designed to work with a range of wireless protocols, including IEEE 802.15.4, 6LoWPAN and ZigBee. | ||
| Line 188: | Line 188: | ||
| delay(100); | delay(100); | ||
| digitalWrite(controlPin, | digitalWrite(controlPin, | ||
| - | + | ||
| + | delay(1000); | ||
| + | | ||
| Serial.begin(9600); | Serial.begin(9600); | ||
| | | ||
| Line 256: | Line 258: | ||
| } | } | ||
| delay(1000); | delay(1000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Radio Transmission ===== | ||
| + | |||
| + | We will use the [[https:// | ||
| + | |||
| + | Here's an example code: | ||
| + | |||
| + | <code C> | ||
| + | /* | ||
| + | |||
| + | Run this sketch on two Zigduinos, open the serial monitor at 9600 baud, and type in stuff | ||
| + | Watch the Rx Zigduino output what you've input into the serial port of the Tx Zigduino | ||
| + | |||
| + | */ | ||
| + | |||
| + | #include < | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | ZigduinoRadio.begin(11); | ||
| + | Serial.begin(9600); | ||
| + | |||
| + | ZigduinoRadio.attachError(errHandle); | ||
| + | ZigduinoRadio.attachTxDone(onXmitDone); | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | if (Serial.available()) | ||
| + | { | ||
| + | ZigduinoRadio.beginTransmission(); | ||
| + | |||
| + | Serial.println(); | ||
| + | Serial.print(" | ||
| + | |||
| + | while(Serial.available()) | ||
| + | { | ||
| + | char c = Serial.read(); | ||
| + | Serial.write(c); | ||
| + | ZigduinoRadio.write(c); | ||
| + | } | ||
| + | |||
| + | Serial.println(); | ||
| + | |||
| + | ZigduinoRadio.endTransmission(); | ||
| + | } | ||
| + | |||
| + | if (ZigduinoRadio.available()) | ||
| + | { | ||
| + | Serial.println(); | ||
| + | Serial.print(" | ||
| + | |||
| + | while(ZigduinoRadio.available()) | ||
| + | Serial.write(ZigduinoRadio.read()); | ||
| + | |||
| + | Serial.println(); | ||
| + | Serial.print(" | ||
| + | Serial.print(ZigduinoRadio.getLqi(), | ||
| + | Serial.print(", | ||
| + | Serial.print(ZigduinoRadio.getLastRssi(), | ||
| + | Serial.print(" | ||
| + | Serial.print(ZigduinoRadio.getLastEd(), | ||
| + | Serial.println(" | ||
| + | } | ||
| + | |||
| + | |||
| + | delay(1000); | ||
| + | } | ||
| + | |||
| + | void errHandle(radio_error_t err) | ||
| + | { | ||
| + | Serial.println(); | ||
| + | Serial.print(" | ||
| + | Serial.print((uint8_t)err, | ||
| + | Serial.println(); | ||
| + | } | ||
| + | |||
| + | void onXmitDone(radio_tx_done_t x) | ||
| + | { | ||
| + | Serial.println(); | ||
| + | Serial.print(" | ||
| + | Serial.print((uint8_t)x, | ||
| + | Serial.println(); | ||
| } | } | ||
| </ | </ | ||