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