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.
Revision 0:266cc01fc2c3, committed 2016-11-10
- Comitter:
- Fathoni17
- Date:
- Thu Nov 10 13:19:25 2016 +0000
- Commit message:
- Board Garudago (Motor6 --> 1 || Motor2 --> 2); key board A --> pwm1++; S --> pwm1--;; key board K --> pwm2++; L --> pwm2--;;
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Thu Nov 10 13:19:25 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/aberk/code/Motor/#c75b234558af
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 10 13:19:25 2016 +0000
@@ -0,0 +1,48 @@
+// Library
+#include "mbed.h"
+#include "Motor.h"
+
+// Deklarasi pin
+Motor motor1 (PB_9, PA_12, PC_5);
+Motor motor2 (PA_11, PA_6, PC_6);
+
+int main (void){
+ Serial pc(USBTX,USBRX);
+ pc.baud(9600);
+ pc.readable();
+ float pwm1=0.1;
+ float pwm2=0.1;
+
+ while(1){
+ char val = pc.getc();
+ switch (val) {
+ case 'a' :{
+ pwm1 = pwm1+0.05;
+ }
+ break;
+ case 's' :{
+ pwm1 = pwm1-0.05;
+ }
+ break;
+ case 'k' :{
+ pwm2 = pwm2+0.05;
+ }
+ break;
+ case 'l' :{
+ pwm2 = pwm2-0.05;
+ }
+ break;
+ }
+ if (pwm1 <= 0.1){
+ pwm1 = 0.1;
+ }
+ if (pwm2 <= 0.1){
+ pwm2 = 0.1;
+ }
+
+ motor1.speed(pwm1);
+ motor2.speed(pwm2);
+ wait_ms(5);
+ pc.printf ("pwm1 = %.5f pwm2 = %.5f\n", pwm1, pwm2);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 10 13:19:25 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85 \ No newline at end of file