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: MODSERIAL QEI mbed
Diff: main.cpp
- Revision:
- 5:a1376ab695f3
- Parent:
- 4:60bc2ee4d838
- Child:
- 6:206fff3b20b0
diff -r 60bc2ee4d838 -r a1376ab695f3 main.cpp
--- a/main.cpp Wed Oct 07 17:46:01 2015 +0000
+++ b/main.cpp Wed Oct 07 18:33:16 2015 +0000
@@ -14,7 +14,7 @@
int main()
{
- float cycle = 0.6;//define the speed of the motor
+ float cycle = 0.6f;//define the speed of the motor
bool motor1_on = 1;
int motor1_dir=0;
@@ -28,8 +28,8 @@
while(button1.read() != motor1_on){// turn on motor 1 when the button is being pressed
led3.write(1);
led1.write(0);
-
- direction1.write(motor1_dir);//turn motor CCW or CW if set to 0
+ pc.printf("%f", speed1.read());
+ direction1.write(motor1_dir);//turn motor CCW or CW
//motor CW = 0
//motor CCW = 1
speed1.period_us(100);//Set period of PWM to 100 us.