test

Committer:
valentinbruchet
Date:
Wed Dec 09 13:09:35 2020 +0000
Revision:
0:9985114fbde9
chrono_trame;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
valentinbruchet 0:9985114fbde9 1 #include "mbed.h"
valentinbruchet 0:9985114fbde9 2
valentinbruchet 0:9985114fbde9 3 Serial xbee(PB_6,PB_7); //Initalise xbee_lib
valentinbruchet 0:9985114fbde9 4 Serial pc(USBTX, USBRX); //Initalise PC serial comms
valentinbruchet 0:9985114fbde9 5
valentinbruchet 0:9985114fbde9 6 int valeur1;
valentinbruchet 0:9985114fbde9 7 int valeur2;
valentinbruchet 0:9985114fbde9 8 int valeur3;
valentinbruchet 0:9985114fbde9 9 int valeur4;
valentinbruchet 0:9985114fbde9 10 int valeur5;
valentinbruchet 0:9985114fbde9 11 int valeur6;
valentinbruchet 0:9985114fbde9 12 int i;
valentinbruchet 0:9985114fbde9 13
valentinbruchet 0:9985114fbde9 14 char recu[20];
valentinbruchet 0:9985114fbde9 15 char data1[3];
valentinbruchet 0:9985114fbde9 16 char data2[3];
valentinbruchet 0:9985114fbde9 17 char data3[3];
valentinbruchet 0:9985114fbde9 18 char data4[3];
valentinbruchet 0:9985114fbde9 19 char data5[3];
valentinbruchet 0:9985114fbde9 20 char data6[3];
valentinbruchet 0:9985114fbde9 21
valentinbruchet 0:9985114fbde9 22 int main()
valentinbruchet 0:9985114fbde9 23 {
valentinbruchet 0:9985114fbde9 24 while(1)
valentinbruchet 0:9985114fbde9 25 {
valentinbruchet 0:9985114fbde9 26 while(xbee.getc()!=('$'));
valentinbruchet 0:9985114fbde9 27 while(xbee.getc()!=('C'));
valentinbruchet 0:9985114fbde9 28 while(xbee.getc()!=('H'));
valentinbruchet 0:9985114fbde9 29 while(xbee.getc()!=('R'));
valentinbruchet 0:9985114fbde9 30 while(xbee.getc()!=('O'));
valentinbruchet 0:9985114fbde9 31 while(xbee.getc()!=('N'));
valentinbruchet 0:9985114fbde9 32 while(xbee.getc()!=('O'));
valentinbruchet 0:9985114fbde9 33
valentinbruchet 0:9985114fbde9 34 while(i<7)
valentinbruchet 0:9985114fbde9 35 {
valentinbruchet 0:9985114fbde9 36 recu[i]=xbee.getc();
valentinbruchet 0:9985114fbde9 37 i=i+1;
valentinbruchet 0:9985114fbde9 38 }
valentinbruchet 0:9985114fbde9 39 i=0;
valentinbruchet 0:9985114fbde9 40
valentinbruchet 0:9985114fbde9 41 data1[0]=recu[0];
valentinbruchet 0:9985114fbde9 42 data1[1]=recu[1];
valentinbruchet 0:9985114fbde9 43 data2[0]=recu[3];
valentinbruchet 0:9985114fbde9 44 data2[1]=recu[4];
valentinbruchet 0:9985114fbde9 45 data3[0]=recu[6];
valentinbruchet 0:9985114fbde9 46 data3[1]=recu[7];
valentinbruchet 0:9985114fbde9 47 data4[0]=recu[9];
valentinbruchet 0:9985114fbde9 48 data4[1]=recu[10];
valentinbruchet 0:9985114fbde9 49 data5[0]=recu[12];
valentinbruchet 0:9985114fbde9 50 data5[1]=recu[13];
valentinbruchet 0:9985114fbde9 51 data6[0]=recu[15];
valentinbruchet 0:9985114fbde9 52 data6[1]=recu[16];
valentinbruchet 0:9985114fbde9 53
valentinbruchet 0:9985114fbde9 54 valeur1=atoi(data1);
valentinbruchet 0:9985114fbde9 55 valeur2=atoi(data2);
valentinbruchet 0:9985114fbde9 56 valeur3=atoi(data3);
valentinbruchet 0:9985114fbde9 57 valeur4=atoi(data4);
valentinbruchet 0:9985114fbde9 58 valeur5=atoi(data5);
valentinbruchet 0:9985114fbde9 59 valeur6=atoi(data6);
valentinbruchet 0:9985114fbde9 60
valentinbruchet 0:9985114fbde9 61 pc.printf("Chronometre candidat 1 : %i:%i:%i\n\r", valeur1, valeur2, valeur3);
valentinbruchet 0:9985114fbde9 62 pc.printf("Chronometre candidat 2 : %i:%i:%i\n\r", valeur4, valeur5, valeur6);
valentinbruchet 0:9985114fbde9 63 }
valentinbruchet 0:9985114fbde9 64 }