tst cli
Dependencies: mbed
main.cpp@0:bf114396bbbb, 2018-06-13 (annotated)
- Committer:
- Ranyd04
- Date:
- Wed Jun 13 06:39:29 2018 +0000
- Revision:
- 0:bf114396bbbb
test cli;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ranyd04 | 0:bf114396bbbb | 1 | #include "mbed.h" |
Ranyd04 | 0:bf114396bbbb | 2 | |
Ranyd04 | 0:bf114396bbbb | 3 | float transducteur_volt; |
Ranyd04 | 0:bf114396bbbb | 4 | int transducteur_pos; |
Ranyd04 | 0:bf114396bbbb | 5 | AnalogIn transducteur(PA_2); |
Ranyd04 | 0:bf114396bbbb | 6 | DigitalOut alim_control(PA_10); |
Ranyd04 | 0:bf114396bbbb | 7 | DigitalOut control_trans(PB_5); |
Ranyd04 | 0:bf114396bbbb | 8 | DigitalOut control_QSD(PA_9); |
Ranyd04 | 0:bf114396bbbb | 9 | //DigitalOut control_vbat(PB_8); |
Ranyd04 | 0:bf114396bbbb | 10 | DigitalOut led(PB_8); |
Ranyd04 | 0:bf114396bbbb | 11 | |
Ranyd04 | 0:bf114396bbbb | 12 | |
Ranyd04 | 0:bf114396bbbb | 13 | int main() |
Ranyd04 | 0:bf114396bbbb | 14 | { |
Ranyd04 | 0:bf114396bbbb | 15 | control_trans=1; |
Ranyd04 | 0:bf114396bbbb | 16 | while(1) |
Ranyd04 | 0:bf114396bbbb | 17 | { |
Ranyd04 | 0:bf114396bbbb | 18 | transducteur_volt = transducteur.read(); |
Ranyd04 | 0:bf114396bbbb | 19 | transducteur_pos = transducteur_volt * 2500; |
Ranyd04 | 0:bf114396bbbb | 20 | printf("\r\n timer %f \r\n", transducteur_volt); |
Ranyd04 | 0:bf114396bbbb | 21 | if(transducteur_pos<1600) |
Ranyd04 | 0:bf114396bbbb | 22 | { |
Ranyd04 | 0:bf114396bbbb | 23 | led = 1; |
Ranyd04 | 0:bf114396bbbb | 24 | } |
Ranyd04 | 0:bf114396bbbb | 25 | else |
Ranyd04 | 0:bf114396bbbb | 26 | { |
Ranyd04 | 0:bf114396bbbb | 27 | led = 0; |
Ranyd04 | 0:bf114396bbbb | 28 | } |
Ranyd04 | 0:bf114396bbbb | 29 | } |
Ranyd04 | 0:bf114396bbbb | 30 | |
Ranyd04 | 0:bf114396bbbb | 31 | } |