게시자: Sundew Shin, 2015. 1. 28. 오후 3:29
[
2015. 2. 3. 오전 8:49에 업데이트됨
]
XBEE <-> A:SoftwareSerial <-> A:UART <-> MAX485 <-> RS485
#include <SoftwareSerial.h>
#define xbee_rx 10
#define xbee_tx 11
SoftwareSerial xbee(xbee_rx, xbee_tx);
void setup(){
pinMode(xbee_rx, INPUT);
pinMode(xbee_tx, OUTPUT);
xbee.begin(9600);
xbee.println("Hello, xbee");
Serial.begin(9600);
Serial.println("Hello, rs");
}
void loop(){
if(Serial.available()){
xbee.write(Serial.read());
}
if(xbee.available()){
Serial.write(xbee.read());
}
}
XBEE <-> MAX485 <-> RS485

Tracker Controller <-> RS485 <-> Wireless (ZigBee) <-> RS485 <-> SCADA
#include <Wire.h>
#include <SoftwareSerial.h>
#include <MPU6050.h>
SoftwareSerial xbee(10, 11);
static const unsigned char req[]= {0x02, 0x00, 0x00, 0x01, 0x0A, 0x63, 0x06, 0x20, 0x00, 0x00, 0x00, 0xEC, 0xC3, 0x03};
void setup(){
xbee.begin(9600);
// Initialize the 'Wire' class for the I2C-bus.
Wire.begin();
// Clear the 'sleep' bit to start the sensor.
MPU6050_write_reg (MPU6050_PWR_MGMT_1, 0);
// Initialize the RS485; The dip switch should be on right pos.
Serial.begin(9600);
}
void loop(){
// print MPU6050 data to a SoftwareSerial
printGyro(xbee);
// request tracker status info (broadcast)
Serial.write(req, 14);
// give some time to respond
delay(500);
// write to xbee when there is RS485 message in.
while(Serial.available()){
xbee.print(Serial.read(), HEX);
xbee.print(F(" "));
}
// time delay
delay(500);
// line feed
xbee.println(F(""));
}
Tracker Controller <-> RS485 <-> Wireless (ZigBee) <-> RPi <-> Cloud
Tracker Controller <-> RS485 <-> Wireless (ZigBee) <-> RPi <-> Cloud
Tracker+Sensors <-> Arduino <-> Wireless (ZigBee) <-> RPi <-> Cloud
|
 Updating...
Ċ Sundew Shin, 2015. 4. 17. 오후 9:36
Sundew Shin, 2015. 2. 2. 오후 11:04
Sundew Shin, 2015. 2. 3. 오후 10:54
|