xbee+arduinoproject · 2017. 3. 4. · xbee Τα xbeeέχουν ένα από τους...
TRANSCRIPT
XBEE+ARDUINO PROJECTComing Soon …. https://github.com/thedog2017
4/3/2017
1
XBEE
Τα Xbee έχουν ένα από τους παρακάτω ρόλους σε ένα δίκτυο
Coordinator Router End Device
4/3/2017
2
ΡΌΛΟΙ XBEE
Σε κάθε δίκτυο Xbee zigbee υπάρχει ένα Coordinator, που παίζει το ρόλο ρίζας ενός δικτύου σε μορφή δέντρου
Σε ένα δίκτυο μπορούν να υπάρχουν πολλαπλά Routers. Αυτά μπορούν να προωθούν πληροφορίες στα End Devices καθώς επίσης και να εκτελούν λειτουργίες εφαρμογών.
Τα End Devices,δεν μπορούν να αναμεταδώσουν δεδομένα , αλλά μόνο να επικοινωνούν με το πατρικό κόμβο είτε Coordinator είτε Routers. Ένα δίκτυο μπορεί να έχει πολλά End Devices.
4/3/2017
3
ΣΧΗΜΑΤΙΚΆ ΔΊΚΤΥΟ XBEE
4/3/2017
4
XBEE + SHIELDS + ARDUINO
4/3/2017
5
ΤΟΠΟΘΕΤΗΜΈΝΑ ΤΑ SHIELDS
4/3/2017
6
ARDUINO SKETCHES
Γυρίζουμε τα διακοπτάκια στα shields σε λειτουργία usb Φορτώνουμε ένα άδειο sketch στα 2 Arduino
4/3/2017
7
4/3/2017
8
4/3/2017
9
4/3/2017
10
ΒΆΖΟΥΜΕ ΡΥΘΜΊΣΕΙς
Setting Acronym XBee 1 Cord XBee 2 End device
Channel CH C CPAN ID ID B8A0 B8A0
Destination Address High DH 0 0
Destination Address Low DL 1 0
16-bit Source Address MY 0 1
4/3/2017
11
ΠΑΡΆΔΕΙΓΜΑ ΕΦΑΡΜΟΓΉς
UNO3 send serial H and L
void setup(){Serial.begin(9600);
}
void loop(){Serial.print('H');delay(1000);Serial.print('L');delay(1000);
}
4/3/2017
12
UNO receive Communication | Physical Pixel sketch
const int ledPin = 13; // the pin that the LED is attached toint incomingByte; // a variable to read incoming serial data into
void setup() {// initialize serial communication:Serial.begin(9600);// initialize the LED pin as an output:pinMode(ledPin, OUTPUT);
}
void loop() {// see if there's incoming serial data:if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:incomingByte = Serial.read();// if it's a capital H (ASCII 72), turn on the LED:if (incomingByte == 'H') {digitalWrite(ledPin, HIGH);
}// if it's an L (ASCII 76) turn off the LED:if (incomingByte == 'L') {digitalWrite(ledPin, LOW);
}}
}
Thedog@ 2017
4/3/2017
13