Gets user Input to turn the servo to certain degrees
user.cpp@2:9d9717796ab2, 2019-01-13 (annotated)
- Committer:
- hzelayasolano22
- Date:
- Sun Jan 13 21:57:11 2019 +0000
- Revision:
- 2:9d9717796ab2
- Parent:
- 1:f67847960b91
- Child:
- 3:5b6a55afc60a
servo.cpp for Lab almost done
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hzelayasolano22 | 1:f67847960b91 | 1 | |
hzelayasolano22 | 1:f67847960b91 | 2 | |
hzelayasolano22 | 1:f67847960b91 | 3 | #include "user.h" |
hzelayasolano22 | 1:f67847960b91 | 4 | Serial pc(USBTX, USBRX); |
hzelayasolano22 | 1:f67847960b91 | 5 | |
hzelayasolano22 | 2:9d9717796ab2 | 6 | void userInit(void) { |
hzelayasolano22 | 1:f67847960b91 | 7 | pc.printf("\n\rType a number between 1 - 9 to move servo! \n\r"); |
hzelayasolano22 | 1:f67847960b91 | 8 | } |
hzelayasolano22 | 1:f67847960b91 | 9 | |
hzelayasolano22 | 1:f67847960b91 | 10 | char GetKeyInput(void) { |
hzelayasolano22 | 1:f67847960b91 | 11 | char c = pc.getc(); |
hzelayasolano22 | 1:f67847960b91 | 12 | pc.printf("%c",c); |
hzelayasolano22 | 1:f67847960b91 | 13 | return (c&0x0F); |
hzelayasolano22 | 1:f67847960b91 | 14 | } |