AresENSEA-CDF2020
/
AresCDFMainCode_us2
Test
main.cpp@10:0714feaaaee1, 2020-09-11 (annotated)
- Committer:
- Nanaud
- Date:
- Fri Sep 11 10:56:08 2020 +0000
- Revision:
- 10:0714feaaaee1
- Parent:
- 6:ea6b30c4bb01
- Child:
- 12:2c312916a621
11.09.20
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nanaud | 1:2fe8c402ee79 | 1 | // Nom du fichier : main.cpp |
Nanaud | 0:dc036b67c87c | 2 | #include "pins.h" |
Nanaud | 0:dc036b67c87c | 3 | |
Nanaud | 6:ea6b30c4bb01 | 4 | void btnFct(){ |
Nanaud | 6:ea6b30c4bb01 | 5 | mot_dis(); |
Nanaud | 6:ea6b30c4bb01 | 6 | aff_cd[0] = 0; |
Nanaud | 6:ea6b30c4bb01 | 7 | aff_cd[1] = 0; |
Nanaud | 6:ea6b30c4bb01 | 8 | |
Nanaud | 6:ea6b30c4bb01 | 9 | pc.printf("comptG = %d\r\n",comptG); |
Nanaud | 6:ea6b30c4bb01 | 10 | pc.printf("comptD = %d\r\n",comptD); |
Nanaud | 6:ea6b30c4bb01 | 11 | bt.printf("comptG = %d\r\n",comptG); |
Nanaud | 6:ea6b30c4bb01 | 12 | bt.printf("comptD = %d\r\n",comptD); |
Nanaud | 6:ea6b30c4bb01 | 13 | } |
Nanaud | 6:ea6b30c4bb01 | 14 | |
Nanaud | 4:ad9b7355332e | 15 | int main() |
Nanaud | 4:ad9b7355332e | 16 | { |
Nanaud | 0:dc036b67c87c | 17 | pc.printf("\r\nAresCDFMainCode\r\n"); |
Nanaud | 4:ad9b7355332e | 18 | bt.printf("\r\nAresCDFMainCode\r\n"); |
Nanaud | 4:ad9b7355332e | 19 | |
Nanaud | 6:ea6b30c4bb01 | 20 | btn.rise(&btnFct); |
Nanaud | 6:ea6b30c4bb01 | 21 | |
Nanaud | 1:2fe8c402ee79 | 22 | // debug |
Nanaud | 1:2fe8c402ee79 | 23 | pc.attach(&serialIT); // Interruption liaison série |
Nanaud | 4:ad9b7355332e | 24 | bt.attach(&bluetoothIT); // Interruption bluetooth |
Nanaud | 6:ea6b30c4bb01 | 25 | pc.baud(9600); |
Nanaud | 6:ea6b30c4bb01 | 26 | pc.format(8,SerialBase::None,1); |
Nanaud | 6:ea6b30c4bb01 | 27 | bt.baud(9600); |
Nanaud | 6:ea6b30c4bb01 | 28 | bt.format(8,SerialBase::None,1); |
Nanaud | 6:ea6b30c4bb01 | 29 | |
Nanaud | 10:0714feaaaee1 | 30 | //ticker_US.attach(&captUS_trig,0.2); // On apelle cette fonction toutes 0.2 secondes |
Nanaud | 10:0714feaaaee1 | 31 | //ticker_affUS.attach(&affUltrasons,1.0); |
Nanaud | 6:ea6b30c4bb01 | 32 | ticker_affcd.attach(&affCodeurs,1.0); |
Nanaud | 10:0714feaaaee1 | 33 | //tickTest.attach(&test4,0.1); |
Nanaud | 4:ad9b7355332e | 34 | |
Nanaud | 1:2fe8c402ee79 | 35 | // Init capteurs à ultrasons |
Nanaud | 1:2fe8c402ee79 | 36 | captUS_init(); |
Nanaud | 0:dc036b67c87c | 37 | echo1.rise(&echoRise1); |
Nanaud | 0:dc036b67c87c | 38 | echo1.fall(&echoFall1); |
Nanaud | 0:dc036b67c87c | 39 | echo2.rise(&echoRise2); |
Nanaud | 0:dc036b67c87c | 40 | echo2.fall(&echoFall2); |
Nanaud | 0:dc036b67c87c | 41 | echo3.rise(&echoRise3); |
Nanaud | 0:dc036b67c87c | 42 | echo3.fall(&echoFall3); |
Nanaud | 0:dc036b67c87c | 43 | echo4.rise(&echoRise4); |
Nanaud | 0:dc036b67c87c | 44 | echo4.fall(&echoFall4); |
Nanaud | 0:dc036b67c87c | 45 | echo5.rise(&echoRise5); |
Nanaud | 0:dc036b67c87c | 46 | echo5.fall(&echoFall5); |
Nanaud | 0:dc036b67c87c | 47 | echo6.rise(&echoRise6); |
Nanaud | 0:dc036b67c87c | 48 | echo6.fall(&echoFall6); |
Nanaud | 4:ad9b7355332e | 49 | |
Nanaud | 1:2fe8c402ee79 | 50 | // Init DRV8825 |
Nanaud | 0:dc036b67c87c | 51 | drv_init(); |
Nanaud | 4:ad9b7355332e | 52 | |
Nanaud | 4:ad9b7355332e | 53 | // Init codeurs |
Nanaud | 0:dc036b67c87c | 54 | cdgA.rise(&cdgaRise); |
Nanaud | 6:ea6b30c4bb01 | 55 | cddA.rise(&cddaRise); |
Nanaud | 0:dc036b67c87c | 56 | cdgA.mode(PullUp); |
Nanaud | 6:ea6b30c4bb01 | 57 | cddA.mode(PullUp); |
Nanaud | 6:ea6b30c4bb01 | 58 | |
Nanaud | 6:ea6b30c4bb01 | 59 | // Odometrie |
Nanaud | 4:ad9b7355332e | 60 | |
Nanaud | 4:ad9b7355332e | 61 | |
Nanaud | 4:ad9b7355332e | 62 | |
Nanaud | 1:2fe8c402ee79 | 63 | while(1) {} |
Nanaud | 0:dc036b67c87c | 64 | } |