A Script to analyse the change in velocity of a DC motor by using an uprising PWM signal.

Dependencies:   MODSERIAL mbed

main.cpp

Committer:
Wallie117
Date:
2015-10-07
Revision:
1:290dc4628f1a
Parent:
0:97f11ee1c518

File content as of revision 1:290dc4628f1a:

// ****************************************************** 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, Lisa Verhoeven, Thijs van der Wal, Ewoud Velu, Emily Zoetbrood

// ********************************** 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);
        }
           
}