Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
|
materiel:xbee:star:processing-codes [2014/09/18 00:42] resonance |
materiel:xbee:star:processing-codes [2014/09/18 00:43] (Version actuelle) resonance |
||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ===== Receive XBee packets in API mode (basics with serial) ===== | ||
| + | <code cpp> | ||
| + | /* | ||
| + | * Receive XBee packets in API mode (basics with serial) | ||
| + | * from http:// | ||
| + | */ | ||
| + | import processing.serial.*; | ||
| + | import xbee.*; | ||
| + | Serial port; | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | println(Serial.list()); | ||
| + | port = new Serial(this, | ||
| + | port.write(" | ||
| + | delay(1100); | ||
| + | port.write(" | ||
| + | } | ||
| + | |||
| + | void draw() | ||
| + | { | ||
| + | while (port.available() != 0) { | ||
| + | String val = hex(port.readChar()); | ||
| + | if (val.equals(" | ||
| + | println(); | ||
| + | } | ||
| + | print(val); | ||
| + | print(" | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | |||
| ===== Receive XBee packets in API mode with xbee-api ===== | ===== Receive XBee packets in API mode with xbee-api ===== | ||