E=MC
/
e=mc
.
Diff: main.cpp
- Revision:
- 1:8e5821dec0f7
- Parent:
- 0:d328ecb3fbb1
- Child:
- 2:30ebae0d3e17
--- a/main.cpp Wed Feb 25 19:12:52 2015 +0000 +++ b/main.cpp Fri Feb 27 00:12:53 2015 +0000 @@ -4,6 +4,8 @@ PwmOut servo(PTA5); PwmOut motor(PTA4); Serial pc(USBTX, USBRX); // tx, rx +DigitalIn din(PTA13); +Timer t; void motor_sweep() { for(float p = 0.0; p<.0025; p+=.0001){ @@ -25,10 +27,25 @@ int main() { servo.period(0.005); motor.period(.0025); + int previous_val = -1; + + t.start(); + int timechange = 0; while(1){ - char choice = pc.getc(); + if(din) { + if(previous_val = 0){ + + } + myled = 1; + pc.printf("dark"); + } else { + myled = 0; + pc.printf("light"); + } + wait(.2f); + //char choice = pc.getc(); //pc.putc(choice); - switch(choice){ + /*switch(choice){ case '0': motor.pulsewidth(0.0); pc.printf("0% \n"); @@ -50,6 +67,7 @@ pc.printf("default"); break; } + */ //servo_sweep(); //motor_sweep(); //motor.pulsewidth(.0025);