pedro neto
/
testepedro
Test program for RFM69 library. Listens and prints packets from "RFM69_Sender" nodes
Revision 2:08246d6498ce, committed 2019-07-29
- Comitter:
- pedroneto1209
- Date:
- Mon Jul 29 18:26:05 2019 +0000
- Parent:
- 1:7bc722e656a5
- Commit message:
- baja
Changed in this revision
Listener.cpp | Show annotated file Show diff for this revision Revisions of this file |
RFM69.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7bc722e656a5 -r 08246d6498ce Listener.cpp --- a/Listener.cpp Thu Feb 26 14:52:03 2015 +0000 +++ b/Listener.cpp Mon Jul 29 18:26:05 2019 +0000 @@ -2,18 +2,20 @@ // From Tnode/Tsender @ anarduino.com // 2014 - anarduino.com // -#include <RFM69.h> -#include <SPI.h> +#include "mbed.h" +#include "RFM69.h" -#define GATEWAY_ID 1 // this is ME, TGateway -#define NETWORKID 101 //the same on all nodes that talk to each other +#define NETWORK_ID 101 +#define BOXRADIO_ID 69 +#define NODE_ID 55 +#define FREQUENCY_915MHZ 91 // Uncomment only one of the following three to match radio frequency //#define FREQUENCY RF69_433MHZ //#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 @@ -22,47 +24,30 @@ #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) -uint8_t msgBuf[MSGBUFSIZE]; -InterruptIn mybutton(USER_BUTTON); -#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_9, PA_10); +DigitalOut myled(PC_13); +DigitalOut but(PA_1, PullUp); //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 +uint8_t data[61]; bool requestACK=false; + Timer tmr; main() { - memset(msgBuf,0,sizeof(msgBuf)); uint8_t theNodeID; tmr.start(); - pc.baud(SERIAL_BAUD); + pc.baud(SERIAL_BAUD); pc.printf("\r\nListener %s startup at %d Mhz...\r\n",VERSION,(FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915)); wait(1); radio.initialize(FREQUENCY, GATEWAY_ID, NETWORKID); radio.encrypt(0); radio.promiscuous(promiscuousMode); -// radio.setPowerLevel(5); + radio.setPowerLevel(20); #ifdef IS_RFM69HW radio.setHighPower(); //uncomment #define ONLY if radio is of type: RFM69HW or RFM69HCW #endif
diff -r 7bc722e656a5 -r 08246d6498ce RFM69.lib --- a/RFM69.lib Thu Feb 26 14:52:03 2015 +0000 +++ b/RFM69.lib Mon Jul 29 18:26:05 2019 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/br549/code/RFM69/#5359d9af2c02 +https://os.mbed.com/users/br549/code/RFM69/#db6e4ce9dc02