NRF24L01P with FRDM KL-25Z as Receiver
Dependencies: ESP8266 mbed nRF24L01P
Fork of NRF-THING by
Revision 2:1cb1ec283154, committed 2017-12-04
- Comitter:
- mrbhatter
- Date:
- Mon Dec 04 11:01:16 2017 +0000
- Parent:
- 1:44646476456d
- Commit message:
- NRF with ESP8266 Thingspeak
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 04 09:44:41 2017 +0000 +++ b/main.cpp Mon Dec 04 11:01:16 2017 +0000 @@ -13,8 +13,8 @@ //buffers for wifi library char resp[1000]; char http_cmd[300], comm[300]; -char count[1]; -int timeout = 8000; + +int timeout = 1000; //SSID and password for connection #define SSID "TAT" @@ -25,7 +25,7 @@ //global variable //float potvalue = 0; //float litvalue = 0; - +int abt; //Update key for thingspeak char* Update_Key = "P2GMSKA9NY7KV0LW"; @@ -103,7 +103,7 @@ wait(1); //create link - sprintf(http_cmd,"/update?api_key=%s&field1=%d",Update_Key,count); + sprintf(http_cmd,"/update?api_key=%s&field1=%d",Update_Key,abt); pc.printf(http_cmd); @@ -121,11 +121,12 @@ int main() { + wifi_initialize(); char RxDataCnt; char temp; - + char count[1]; my_nrf24l01p.powerUp(); - my_nrf24l01p.setRfFrequency(2500); + my_nrf24l01p.setRfFrequency(2400); // Display the (default) setup of the nRF24L01+ chip pc.printf( "nRF24L01+ Frequency : %d MHz\r\n", my_nrf24l01p.getRfFrequency() ); @@ -138,14 +139,19 @@ my_nrf24l01p.setTransferSize( RxDataCnt ); my_nrf24l01p.setReceiveMode(); my_nrf24l01p.enable(); - wifi_initialize(); + while (1) { - //if ( my_nrf24l01p.readable() ) { + if ( my_nrf24l01p.readable() ) + { temp = my_nrf24l01p.read( NRF24L01P_PIPE_P0, count, RxDataCnt ); + abt=count[0]; pc.printf( "%d\r\n",count[0]); - wait_ms(10); - //} - wifi_send(); - wait(30); + wifi_send(); + wait(24); + + } + // +// wait(20); + } }