Programmaatje om de motoren aan te sturen met PuTTY.
Dependencies: Encoder MODSERIAL mbed
Diff: main.cpp
- Revision:
- 0:bd2d5dd6d9ff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Oct 22 10:49:40 2014 +0000 @@ -0,0 +1,43 @@ +#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); + } +} \ No newline at end of file