B Rey
/
RFM69_Sender
Test program for RFM69 library. Sends time,temperature and RSSI to "RFM69_listener"
Diff: Sender.cpp
- Revision:
- 2:2143c1d1f460
- Parent:
- 0:43464f6d23ee
- Child:
- 3:450e37e0ffd6
diff -r 71aa8c9010e2 -r 2143c1d1f460 Sender.cpp --- a/Sender.cpp Thu Feb 26 04:22:53 2015 +0000 +++ b/Sender.cpp Thu Feb 26 14:44:13 2015 +0000 @@ -9,7 +9,7 @@ #include <RFM69.h> #define GATEWAY_ID 1 -#define NODE_ID 10 // node ID +#define NODE_ID 9 // node ID #define NETWORKID 101 //the same on all nodes that talk to each other #define MSG_INTERVAL 100 @@ -18,7 +18,7 @@ //#define FREQUENCY RF69_868MHZ #define FREQUENCY RF69_915MHZ -//#define IS_RFM69HW //NOTE: uncomment this ONLY for RFM69HW or RFM69HCW +#define IS_RFM69HW //NOTE: uncomment this ONLY for RFM69HW or RFM69HCW #define ENCRYPT_KEY "EncryptKey123456" // use same 16byte encryption key for all devices on net #define ACK_TIME 50 // max msec for ACK wait #define LED 9 // Anardino miniWireless has LEDs on D9 @@ -28,7 +28,7 @@ #define MSGBUFSIZE 64 // message buffersize, but for this demo we only use: // 1-byte NODEID + 4-bytes for time + 1-byte for temp in C + 2-bytes for vcc(mV) char msgBuf[MSGBUFSIZE]; -DigitalOut myled(D9); // LED on the RFM69 breakout is wired to D9 +DigitalOut myled(LED1); // LED on the RFM69 breakout is wired to D9 #ifdef TARGET_NUCLEO_F401RE Serial pc(USBTX, USBRX); @@ -45,7 +45,8 @@ #elif defined(TARGET_LPC1768) Serial pc(USBTX, USBRX); //RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) -RFM69 radio(D11,D12,D13,D10,D8); +RFM69 radio(D11,D12,D13,D10,D8); // Seeedstudio Arch Pro +//RFM69 radio(p5, p6, p7, p10, p9,p8) // Mbed 1768 ? #endif bool promiscuousMode = false; // set 'true' to sniff all packets on the same network @@ -63,7 +64,7 @@ wait(2); radio.initialize(FREQUENCY, NODE_ID, NETWORKID); radio.encrypt(0); - radio.setPowerLevel(10); + radio.setPowerLevel(20); radio.promiscuous(promiscuousMode); #ifdef IS_RFM69HW radio.setHighPower(); //uncomment #define ONLY if radio is of type: RFM69HW or RFM69HCW