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: Encoder HIDScope MODSERIAL mbed-dsp mbed
Diff: main.cpp
- Revision:
- 14:affdb0636f24
- Parent:
- 13:7fe679538649
- Child:
- 15:7d142004b400
--- a/main.cpp Tue Oct 28 11:21:09 2014 +0000
+++ b/main.cpp Tue Oct 28 13:16:00 2014 +0000
@@ -74,12 +74,13 @@
int main()
{
- /*//motor1
+ //motor1
speed1 = 0.7;
hoek1 = 0.09; //in seconde
wait(1);
+ pwm_motor1.write(0.1);
pwm_motor1.period_us(100);
- motordir1=0; //aangeven van directie
+ motordir1=0; //aangeven van directie (0 = CCW)
pwm_motor1.write(speed1); //snelheid van de motor
wait(hoek1); //Hierdoor kun je het aantal graden bepalen die de as draait
pwm_motor1.write(0);
@@ -98,10 +99,10 @@
pwm_motor1.write(speed1);
wait(hoek1);
pwm_motor1.write(0);
- */
+
//motor2
- wait(1);
+ /*wait(1);
speed2 = 1;
motordir1=1;
pwm_motor1.write(0.1); //Deze snelheid kan lager worden ingesteld om accurator te zijn.
@@ -116,7 +117,7 @@
motordir1=1; //CW
pwm_motor1.write(0.1); //Deze kan lager worden ingesteld om accurater terug te gaan.
wait(0.5); //terug naar begin positie, 20 graden
- pwm_motor1.write(0);
+ pwm_motor1.write(0); */
Ticker log_timer;
Ticker timer;
@@ -126,6 +127,6 @@
pc.baud(115200);
while(1) {
wait(0.2);
- pc.printf("%d, %f \r\n", motor1.getPosition(), motor1.getSpeed());
+ pc.printf("%d\r\n", motor1.getPosition());
}
}