Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-os nRF24L01P
Revision 14:1b41c5adf46e, committed 2022-10-13
- Comitter:
- evedelegue
- Date:
- Thu Oct 13 10:39:25 2022 +0000
- Parent:
- 13:50de0cf096d1
- Commit message:
- je ne sais plus si je l'avais bien commit;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Jun 02 17:12:10 2022 +0000 +++ b/main.cpp Thu Oct 13 10:39:25 2022 +0000 @@ -29,7 +29,6 @@ Thread tir_thread; Thread dribble_thread; - #define TRANSFER_SIZE 14 char chaine[150]; @@ -43,6 +42,7 @@ void reception() { + my_nrf24l01p.powerUp(); my_nrf24l01p.setRfFrequency(2424); my_nrf24l01p.setAirDataRate(1000); @@ -68,7 +68,7 @@ reception8[i]= tampon; } idrobot = reception16[6]; - if (idrobot==1){ + if (idrobot==0){ Vavance = reception16[0]; Vlat = reception16[1]; @@ -76,7 +76,7 @@ idcharge = reception16[3]; idtir = reception16[4]; dribble = reception16[5]; - + dd=(dribble!=0); //alors là c'est juste un test mais il y a quasi aucune chance que ça marche sprintf(chaine," Vav = %d, Vlat = %d, Wz = %d, dribble= %d, idtir= %d, idcharge= %d, idrobot= %d \n\r",(int)Vavance, (int)Vlat, (int)Wz, (int)dribble, (int)idtir, (int)idcharge, (int)idrobot); pc_serie.write(chaine, strlen(chaine)); @@ -96,24 +96,23 @@ } void Dribble(){ - while(1){ - dd=(idtir!=0); - }} - +} + void Tir(){ while(1){ - if (dribble!=0){ + if (idtir!=0){ tir = 1 ; - ThisThread::sleep_for(dribble); + ThisThread::sleep_for(idtir); tir = 0 ; } tir=0;} } int main(){ - +dd=0; reception8 = (char*) reception16; reception_thread.start(reception); dribble_thread.start(Dribble); + tir_thread.start(Tir); } \ No newline at end of file