![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test program for RFM69 library. Sends time,temperature and RSSI to "RFM69_listener"
Diff: Sender.cpp
- Revision:
- 4:55cfd0071af9
- Parent:
- 3:450e37e0ffd6
--- a/Sender.cpp Thu Feb 26 14:49:35 2015 +0000 +++ b/Sender.cpp Mon Jul 29 19:59:18 2019 +0000 @@ -1,15 +1,14 @@ -#include "mbed.h" - // Code from TNode/TGateway @ Anarduino.com // NOTE: code sample was inspired from ideas gained from: https://github.com/aanon4/RFM69 // // Sender - periodically send time(millis), radio temperature, RSSI to listener... // 2014 - anarduino.com // -#include <RFM69.h> +#include "RFM69.h" +#include "mbed.h" #define GATEWAY_ID 1 -#define NODE_ID 9 // node ID +#define NODE_ID 41 // node ID #define NETWORKID 101 //the same on all nodes that talk to each other #define MSG_INTERVAL 100 @@ -19,41 +18,23 @@ #define FREQUENCY RF69_915MHZ #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 +#define ENCRYPT_KEY "EncryptKey123456" +#define ACK_TIME 50 +#define LED PC_13 #define SERIAL_BAUD 115200 #define VERSION "1.0" -#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) +#define MSGBUFSIZE 64 + char msgBuf[MSGBUFSIZE]; -#ifdef TARGET_NUCLEO_F401RE -Serial pc(USBTX, USBRX); -DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 -//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) -RFM69 radio(D11,D12,D13,D10,D8); -#elif defined(TARGET_NUCLEO_L152RE) -Serial pc(USBTX, USBRX); -DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 +Serial pc(PA_2, PA_3); +DigitalOut myled(PC_13); //"Moteino Half Shield" has LED on D9 //RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) -RFM69 radio(D11,D12,D13,D10,D8); -#elif defined(TARGET_LPC1114) -Serial pc(USBTX, USBRX); -DigitalOut myled(LED1); -//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) -RFM69 radio(dp2,dp1,dp6,dp4,dp9); -#elif defined(TARGET_LPC1768) -Serial pc(USBTX, USBRX); -DigitalOut myled(D9); //"Moteino Half Shield" has LED on D9 -//RFM69::RFM69(PinName PinName mosi, PinName miso, PinName sclk,slaveSelectPin, PinName int) -RFM69 radio(D11,D12,D13,D10,D8); // Seeedstudio Arch Pro -//RFM69 radio(p5, p6, p7, p10, p9,p8) // Mbed 1768 ? -#endif +RFM69 radio(PB_15, PB_14, PB_13, PB_12, PA_8); bool promiscuousMode = false; // set 'true' to sniff all packets on the same network -bool requestACK=false; +bool requestACK = false; Timer tmr; main() {