Noam Nahum
/
Speed
aa
Revision 0:78be441efc5a, committed 2021-06-16
- Comitter:
- noamnahum
- Date:
- Wed Jun 16 18:48:11 2021 +0000
- Commit message:
- for itay; a
Changed in this revision
diff -r 000000000000 -r 78be441efc5a Motor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Wed Jun 16 18:48:11 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/noamnahum/code/ForItay/#79e803bc20ca
diff -r 000000000000 -r 78be441efc5a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 16 18:48:11 2021 +0000 @@ -0,0 +1,96 @@ +#include "mbed.h" +#include "Motor.h" +Serial pc(USBTX, USBRX); +Motor myMotor(PA_1, PA_0); +Motor isMotor(PB_0, PA_4); +Motor miMotor(PF_0, PA_3); +Motor hisMotor(PA_7, PA_5); +char incoming; +float wx = 0; +float wy = 0; +float wz = 0; +float wp = 0; + +int main() { + + pc.baud(9600); + while(1){ + if(pc.readable()) { + incoming = pc.getc(); + switch(incoming) { + case 'a': + wx = wx+0.02; + myMotor.speed(wx); + pc.printf("Motor 1 is: %4f\r\n", wx); + break; + case 's': + wx = wx-0.02; + myMotor.speed(wx); + pc.printf("Motor 1 s: %4f\r\n", wx); + break; + + case 'd': + wx = 0.0; + myMotor.speed(wx); + pc.printf("Motor 1 is: 4f\r\n", wx); + break; + case 'z': + wy = wy+0.02; + isMotor.speed(wy); + pc.printf("Motor 2 is: %4f\r\n", wy); + break; + case 'x': + wy = wy-0.02; + isMotor.speed(wy); + pc.printf("Motor 2 is: %4f\r\n", wy); + break; + + case 'c': + wy = 0.0; + isMotor.speed(wy); + pc.printf("Motor 2 is: %4f \r\n", wy); + break; + case 'f': + wz = wz+0.02; + miMotor.speed(wz); + pc.printf("Motor 3 is: %4f\r\n", wz); + break; + case 'g': + wz = wz-0.02; + miMotor.speed(wz); + pc.printf("Motor 3 is: %4f\r\n", wz); + break; + + case 'h': + wz = 0.0; + miMotor.speed(wz); + pc.printf("Motor 3 is: %4f\r\n", wz); + break; + case 'v': + wp = wp+0.02; + hisMotor.speed(wp); + pc.printf("Motor 4 is: %4f\r\n", wp); + break; + case 'b': + wp = wp-0.02; + hisMotor.speed(wp); + pc.printf("Motor 4 is: %4f\r\n", wp); + break; + + case 'n': + wp = 0.0; + hisMotor.speed(wp); + pc.printf("Motor 4 is: %4f \r\n", wp); + break; + case 'p': + pc.printf("Motor 1 is: %4f\r\n", wx); + pc.printf("Motor 2 is: %4f \r\n", wy); + pc.printf("Motor 3 is: 4f\r\n", wz); + pc.printf("Motor 4 is: %4f \r\n", wp); + break; + } + } + + + } +}
diff -r 000000000000 -r 78be441efc5a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 16 18:48:11 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file