Programmaatje om de motoren aan te sturen met PuTTY.

Dependencies:   Encoder MODSERIAL mbed

main.cpp

Committer:
BasvanBuuren
Date:
2014-10-22
Revision:
0:bd2d5dd6d9ff

File content as of revision 0:bd2d5dd6d9ff:

#include "mbed.h"
#include "encoder.h"
#include <iostream>

int main()
{
    PwmOut m_speed1(PTA5);
    DigitalOut m_dir1(PTA4);
    PwmOut m_speed2(PTC8);
    DigitalOut m_dir2(PTC9);    
    
    float s_speed1;
    float s_dir1;
    float s_speed2;
    float s_dir2;
    
    
    while(1)
    {
        cout << "Speed motor 1: " << endl;
        cin >> s_speed1;
        cout << s_speed1 << endl;
        cout << "Direction motor 1: " << endl;
        cin >> s_dir1;
        cout << s_dir1 << endl;
        cout << "Speed motor 2: " << endl;
        cin >> s_speed2;
        cout << s_speed2 << endl;
        cout << "Direction motor 2: " << endl;
        cin >> s_dir2;
        cout << s_dir2 << endl;
        m_speed1=0;
        m_speed2=0;
        cout << "Wait for it..." <<endl;
        wait(3);
        m_speed1=s_speed1;
        m_dir1=s_dir1;
        m_speed2=s_speed2;
        m_dir2=s_dir2;
        cout << "Go!" << endl;
        wait(3);
    }
}