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.
Diff: main_old.txt
- Revision:
- 0:708b17957be1
diff -r 000000000000 -r 708b17957be1 main_old.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main_old.txt Thu Jan 28 09:51:37 2021 +0000
@@ -0,0 +1,50 @@
+#include "mbed.h"
+
+
+PwmOut DCMotor(D6);
+PwmOut ServoClockWise(D5);
+PwmOut ServoCounterCW(D3);
+
+DigitalOut DCMotor_IN1(D7);
+DigitalOut DCMotor_IN2(D8);
+DigitalOut ServoEnable(D4);
+
+
+
+int main()
+{
+ DCMotor.period_ms(20); // shoul be 20 ms (490 Hz) and 10 ms for the servo (980 Hz)
+ ServoClockWise.period_ms(10);
+ ServoCounterCW.period_ms(10);
+ ServoEnable=1;
+
+ DCMotor_IN1=0;
+ DCMotor_IN2=1;
+ DCMotor.pulsewidth_us(1500);
+// wait(5);
+// DCMotor.pulsewidth_ms(0);
+
+
+
+ while(0){
+
+ DCMotor_IN1=0;
+ DCMotor_IN2=1;
+ DCMotor.pulsewidth_ms(2);
+ ServoClockWise.pulsewidth_us(0);
+ ServoCounterCW.pulsewidth_us(100);
+ wait_ms(1000);
+ ServoCounterCW.pulsewidth_us(19000);
+ wait_ms(1000);
+
+ DCMotor_IN1=1;
+ DCMotor_IN2=0;
+ DCMotor.pulsewidth_ms(10);
+ ServoCounterCW.pulsewidth_us(0);
+ ServoClockWise.pulsewidth_us(100);
+ wait_ms(1000);
+ ServoClockWise.pulsewidth_us(19000);
+ wait_ms(1000);
+
+ }
+}