Mike EI2I
/
CANPotar
Gestion d'un potentiomètre avec bus CAN je crois
main.cpp@0:5d51daecce18, 2015-03-11 (annotated)
- Committer:
- Kemix
- Date:
- Wed Mar 11 09:22:41 2015 +0000
- Revision:
- 0:5d51daecce18
Le potard controle les LED;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kemix | 0:5d51daecce18 | 1 | #include "mbed.h" |
Kemix | 0:5d51daecce18 | 2 | |
Kemix | 0:5d51daecce18 | 3 | int main(void){ |
Kemix | 0:5d51daecce18 | 4 | |
Kemix | 0:5d51daecce18 | 5 | AnalogIn Pot(A0); |
Kemix | 0:5d51daecce18 | 6 | DigitalOut led1(LED1); |
Kemix | 0:5d51daecce18 | 7 | DigitalOut led2(LED2); |
Kemix | 0:5d51daecce18 | 8 | DigitalOut led3(LED3); |
Kemix | 0:5d51daecce18 | 9 | DigitalOut led4(LED4); |
Kemix | 0:5d51daecce18 | 10 | |
Kemix | 0:5d51daecce18 | 11 | while(1){ |
Kemix | 0:5d51daecce18 | 12 | led1 = (Pot > 0.2f) ? 1:0; |
Kemix | 0:5d51daecce18 | 13 | led2 = (Pot > 0.4f) ? 1:0; |
Kemix | 0:5d51daecce18 | 14 | led3 = (Pot > 0.6f) ? 1:0; |
Kemix | 0:5d51daecce18 | 15 | led4 = (Pot > 0.8f) ? 1:0; |
Kemix | 0:5d51daecce18 | 16 | } |
Kemix | 0:5d51daecce18 | 17 | |
Kemix | 0:5d51daecce18 | 18 | } |