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: AVEncoder QEI mbed-src-AV
Revision 0:fa523db3f4f5, committed 2015-10-20
- Comitter:
- intgsull
- Date:
- Tue Oct 20 01:40:02 2015 +0000
- Child:
- 1:5b9fa1823663
- Commit message:
- testing
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Oct 20 01:40:02 2015 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+
+PwmOut motor1_forward(PB_4);
+PwmOut motor1_reverse(PB_10);
+PwmOut motor2_forward(PA_7);
+PwmOut motor2_reverse(PB_6);
+
+DigitalOut myled(LED1);
+
+void rightForward(float speed);
+void leftForward(float speed);
+
+int main() {
+ rightForward(0.5);
+ leftForward(-0.5);
+ // mypwm.period_ms(10);
+ //mypwm.pulsewidth_ms(1);
+
+ //printf("pwm set to %.2f %%\n", mypwm.read() * 100);
+
+ while(1) {
+ myled = !myled;
+ wait(1);
+ }
+}
+
+void rightForward(float speed) {
+ if (speed == 0) {
+ motor1_forward = 1.0;
+ motor1_reverse = 1.0;
+ }
+
+ if (speed > 0) {
+ motor1_forward = speed;
+ motor1_reverse = 0;
+ }
+
+ else {
+ motor1_forward = 0;
+ motor1_reverse = -speed;
+ }
+}
+
+void leftForward(float speed) {
+ if (speed == 0) {
+ motor2_forward = 1.0;
+ motor2_reverse = 1.0;
+ }
+
+ if (speed > 0) {
+ motor2_forward = speed;
+ motor2_reverse = 0;
+ }
+
+ else {
+ motor2_forward = 0;
+ motor2_reverse = -speed;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 20 01:40:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file