2.007 PulleyInterface mbed code. Biomimetics robotics lab. Sangbae Kim. Ben Katz. For use with PulleyInterface.mlapp
Diff: main.cpp
- Revision:
- 6:73e417b1c521
- Parent:
- 5:f4c237d0bb32
- Child:
- 7:1726c40ad774
--- a/main.cpp Mon Feb 06 20:03:40 2017 +0000 +++ b/main.cpp Tue Feb 07 20:02:52 2017 +0000 @@ -104,7 +104,19 @@ if(pc.readable()) { char charIn = pc.getc(); - if(charIn == 'g'){ end = clock(); break; } + if(charIn == 'g'){ + fflush(pc); // TODO: this was recently changed check to see it causes no bugs + end = clock(); /* TODO: fix clock things */ + ZeroEncoder(); + velocity = 0; + startcount = 0; + endcount = 0; + currentSensed = 0; + break; + } else if(isdigit(charIn)) { + double abrahamsCommand = (double)(charIn - '0'); + pwm.write(abrahamsCommand/10.0); + } } wait(0.05); } @@ -129,7 +141,6 @@ char charIn = pc.getc(); if(charIn == 'r'){ fflush(pc); /* TODO: purge much better than this! */ -// green = !green; break; } else if(isdigit(charIn)) { double abrahamsCommand = (double)(charIn - '0');