p2p-pingpong-clickbutton
Dependencies: PingPong-P2P-ClickButtonToWork-SX1272 Lora_SX1272_Coragem
Diff: main.cpp
- Revision:
- 6:c305f2aa79a4
- Parent:
- 5:ef21a65a3450
--- a/main.cpp Wed Dec 04 11:50:35 2019 +0000 +++ b/main.cpp Wed Mar 17 20:14:13 2021 +0000 @@ -25,6 +25,10 @@ char float_breathing_time[10]; char float_diving_time[10]; +///////////// +//tESTING INPUT AND OUTPUT +////////////// + //Timer seconds; //================================================ @@ -51,7 +55,7 @@ // Configuration /////////////////////////////////////// - + printf(" Turning the LEDs on ..\n"); led1=1;//----on leds--- led2=1; @@ -74,7 +78,8 @@ sx1272.writeRegister(REG_OP_MODE,133); //leitura continua sx1272.writeRegister(REG_IRQ_FLAGS_MASK,187);//configure interrupt mask to interrupt only when a packet receive and packet envied - + + printf("Turning the LEDs off ..\n"); led1=0;//----off leds--- led2=0; @@ -86,13 +91,24 @@ /////////////////////////////////////// while(1){ - + if (!button1){ - led2=1; - send_data(PING); - led2=0; + //test scanf + //led1=1; + //led2=1; + //char ch; + // printf("Enter one char"); + //scanf("%c", &ch); + // printf("%c\n",ch); + + + printf("SENDING PING\n"); + send_data(PING); + // send_data(DATA); + + } - + // if (button3 != beathing) { // beathing = !beathing; // if(button3){ @@ -126,3 +142,57 @@ } } + +/* + +//////// +//TESTING fREQUENCY CONFIGURATION +//////////////// + + + +#include "lora.txt" + +int main(void) { + + uint8_t config_message[] = "1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm1234567890qwertyuiopasdfghjklzxcvbnm01234567890123456789"; + + + led1=1;//----on leds--- + led2=1; + + //____Configuration bme280 + bme_init(); + + //____Configuration Lora + Thread eventThread; + eventThread.start(callback(&queue, &EventQueue::dispatch_forever)); + + dio0.rise(queue.event(&print_packet)); //configure interrupt rotine ro recieve packet + setup(); //configura sx1272 + + sx1272.writeRegister(REG_OP_MODE,133); //leitura continua + sx1272.writeRegister(REG_IRQ_FLAGS_MASK,187);//configure interrupt mask to interrupt only when a packet receive and packet envied + + led1=0;//----off leds--- + led2=0; + + printf("PROGRAM STARTS\n"); + while(1){ + + led1=1; + led2=1; + send_data(PING); + led2=0; + + +// if (button3){ +// // send_data(DATA); +//// send_packet(big_message,sizeof(big_message)); +//// send_packet(reset_message,sizeof(reset_message)); +//// wait_ms(400); + wait_ms(500); + } + +} +*/ \ No newline at end of file