Biorobotics10
/
frdm_snelheidopbouwen
A Script to analyse the change in velocity of a DC motor by using an uprising PWM signal.
Diff: main.cpp
- Revision:
- 0:97f11ee1c518
- Child:
- 1:290dc4628f1a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 07 11:42:13 2015 +0000 @@ -0,0 +1,34 @@ +// ****************************************************** MOTORSHIELD Script for rising velocity *************************************************** +// This script has been written to gaing knowledge how the motor reacts to diffrent PWM values. +// This script may be used for research an industrial use. +// Author: Robert v/d Wal + +// ********************************** LIBRARIES DECLARATION ******************************************* +#include "mbed.h" +#include "MODSERIAL.h" + +// ********************************** FUNCTION DECLARATION ******************************************* + +DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) +PwmOut motor2speed(D5); + +// **************************************************************************************************************************************************** + +// Script DC Motor velocity + +int main() +{ + double p =0; + double j =0; + motor2direction.write(1); + + for(int i=0;i<11; i++) + { + + j = j +1; + p = j*0.1; + motor2speed.write(p); + wait(0.4); + } + +} \ No newline at end of file