Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed PinDetect
Fork of FinalMotorControl by
Revision 2:25bcc26f7a5b, committed 2016-04-07
- Comitter:
- rlanghbv
- Date:
- Thu Apr 07 11:05:26 2016 +0000
- Parent:
- 1:a3287196a9b3
- Child:
- 3:15be78948724
- Commit message:
- Using Serial instead of STDIN
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 07 10:51:36 2016 +0000
+++ b/main.cpp Thu Apr 07 11:05:26 2016 +0000
@@ -1,6 +1,7 @@
#include "mbed.h"
#include "rtos.h"
+Serial pc(USBTX, USBRX); // tx, rx
//Analog Pins
DigitalOut IN1(D3);
@@ -69,14 +70,19 @@
{
while(true)
{
- scanf(" %c", &global_direction);
+ //scanf(" %c", &global_direction);
+ //global_direction=getchar();
+ if(pc.readable())
+ { global_direction=pc.getc(); }
+
+ Thread::wait(10);
}
}
int main()
{
//Thread 1 has constant feed from usb
- //Thread t1(input);
+ Thread t1(input);
while (true)
{
step4Left();
