Tony Lin
/
BX-car
hello
Fork of BX-car by
pot.cpp@7:fd976e1ced33, 2014-06-22 (annotated)
- Committer:
- backman
- Date:
- Sun Jun 22 13:58:01 2014 +0000
- Revision:
- 7:fd976e1ced33
- Child:
- 10:9f0ce6ba7663
printf should use right type
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
backman | 7:fd976e1ced33 | 1 | |
backman | 7:fd976e1ced33 | 2 | #include "mbed.h" |
backman | 7:fd976e1ced33 | 3 | #include "pot.h" |
backman | 7:fd976e1ced33 | 4 | |
backman | 7:fd976e1ced33 | 5 | |
backman | 7:fd976e1ced33 | 6 | |
backman | 7:fd976e1ced33 | 7 | BX_pot::BX_pot(char t){ |
backman | 7:fd976e1ced33 | 8 | |
backman | 7:fd976e1ced33 | 9 | |
backman | 7:fd976e1ced33 | 10 | switch (t){ |
backman | 7:fd976e1ced33 | 11 | case '1': |
backman | 7:fd976e1ced33 | 12 | pot_in = new AnalogIn (PTB3); |
backman | 7:fd976e1ced33 | 13 | break; |
backman | 7:fd976e1ced33 | 14 | case '2': |
backman | 7:fd976e1ced33 | 15 | pot_in = new AnalogIn (PTB2); |
backman | 7:fd976e1ced33 | 16 | break; |
backman | 7:fd976e1ced33 | 17 | } |
backman | 7:fd976e1ced33 | 18 | |
backman | 7:fd976e1ced33 | 19 | |
backman | 7:fd976e1ced33 | 20 | |
backman | 7:fd976e1ced33 | 21 | } |
backman | 7:fd976e1ced33 | 22 | |
backman | 7:fd976e1ced33 | 23 | float BX_pot::read(void){ |
backman | 7:fd976e1ced33 | 24 | |
backman | 7:fd976e1ced33 | 25 | |
backman | 7:fd976e1ced33 | 26 | |
backman | 7:fd976e1ced33 | 27 | return pot_in->read(); |
backman | 7:fd976e1ced33 | 28 | |
backman | 7:fd976e1ced33 | 29 | |
backman | 7:fd976e1ced33 | 30 | } |