Clark Lin
/
BX-car_s
QQQ
Fork of BX-car_s by
pot.cpp@23:d6d4e8adf7fe, 2014-07-02 (annotated)
- Committer:
- physicsgood
- Date:
- Wed Jul 02 13:33:49 2014 +0000
- Revision:
- 23:d6d4e8adf7fe
- Parent:
- 7:fd976e1ced33
- Child:
- 10:9f0ce6ba7663
QQQQ
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 | } |