Gets user Input to turn the servo to certain degrees
user.cpp@1:f67847960b91, 2019-01-11 (annotated)
- Committer:
- hzelayasolano22
- Date:
- Fri Jan 11 19:56:55 2019 +0000
- Revision:
- 1:f67847960b91
- Parent:
- 0:1f19faa3ee1f
- Child:
- 2:9d9717796ab2
User.cpp outline finished
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 | 1:f67847960b91 | 6 | void HostInit(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 | } |