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 MODSERIAL mbed HIDScope
Fork of frdm_Motortryout2 by
Revision 3:051c91b04acd, committed 2015-09-21
- Comitter:
- Rvs94
- Date:
- Mon Sep 21 11:16:34 2015 +0000
- Parent:
- 2:2b8a8be38c85
- Child:
- 4:69c6cc1247c1
- Commit message:
- Werkend motorscripts
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 21 11:14:12 2015 +0000
+++ b/main.cpp Mon Sep 21 11:16:34 2015 +0000
@@ -3,42 +3,29 @@
#include "MODSERIAL.h"
Serial pc(USBTX, USBRX); // tx, rx
-DigitalOut led1(LED_RED);
-DigitalOut led2(LED_BLUE);
+DigitalOut led(LED_RED);
DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield)
PwmOut motor2speed(D5);
DigitalIn button1(SW3);
-DigitalIn button2(SW2);
-
-const int ledOff = 1;
-const int ledOn = 0;
int main()
{
- motor2direction = 1;
+ motor2direction = 0;
motor2speed = 0;
- led1 = ledOff;
- led2 = ledOff;
+ led = 1;
pc.baud(9600);
while(true)
{
- for(button1 == 0);
+ if(button1 == 0)
{
+ motor2direction = 1;
motor2speed = 0.5f;
pc.printf("het werkt");
wait(1);
- led1 = ledOn;
+ led = 0;
wait(0.2f);
motor2speed = 0;
- led1 = ledOff;
+ led = 1;
}
- for(button2 == 0);
- {
- motor2speed = 1;
- led2 = ledOn;
- wait(0.5f);
- led2 = ledOff;
- }
-
}
}
\ No newline at end of file
