
code to drive the motors to the right position
Dependencies: HIDScope QEI mbed
Fork of BMT-K9_potmeter_fade by
Revision 2:6a4a2e355cd9, committed 2015-09-17
- Comitter:
- ewoud
- Date:
- Thu Sep 17 08:38:02 2015 +0000
- Parent:
- 1:f5b12280ea8a
- Child:
- 3:6a97e1d68511
- Commit message:
- 2 motors pwm control by pot meter;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Sep 15 17:10:27 2015 +0000 +++ b/main.cpp Thu Sep 17 08:38:02 2015 +0000 @@ -4,12 +4,14 @@ // myled is an object of class PwmOut. It uses the LED_RED pin // in human speech: myled is an output that can be controlled with PWM. LED_RED is the pin which is connected to the output -PwmOut myled2(D9); -PwmOut myled1(D7); +PwmOut myled2(D5); +PwmOut myled1(D6); + +//DigitalOut motor1(D4); // pot is an object of class AnalogIn. It uses the PTB0 pin // in human speech: pot is an analog input. You can read the voltage on pin PTB0 -AnalogIn pot1(A1); -AnalogIn pot2(A0); +AnalogIn pot1(A0); +AnalogIn pot2(A1); //HIDScope scope(1); Serial pc(USBTX, USBRX); @@ -21,6 +23,7 @@ //period of PWM signal is 10kHz. Every 100 microsecond a new PWM period is started myled1.period_ms(0.1); myled2.period_ms(0.1); + //motor1=1; //while 1 is unequal to zero. For humans: loop forever while(1) { pc.printf("potvalue: %f \n",pot1.read());