Rauno U
/
Miisu
Six crescent shaped legs
Diff: main.cpp
- Revision:
- 46:49f3da891e24
- Parent:
- 45:409988ab53e4
- Child:
- 47:4f418a4b0051
diff -r 409988ab53e4 -r 49f3da891e24 main.cpp --- a/main.cpp Tue Jun 21 10:56:08 2016 +0000 +++ b/main.cpp Tue Jun 21 11:41:18 2016 +0000 @@ -95,7 +95,7 @@ for (int i = 0; i < MOTORS; i++) sum += abs(ms[i]->errorTurn); - pc.printf("%.2f %d%d\n",speed,dir,turn); + pc.printf(""); //pc.printf("%f\n",sum); } while(sum > 0.05f); @@ -107,8 +107,7 @@ { for (int i = 0; i < MOTORS; i++) { - if (i != 3) - ms[i]->drive(0.2f); + ms[i]->drive(0.2f); } bool done; @@ -117,13 +116,10 @@ done = true; for (int i = 0; i < MOTORS; i++) { - if (i != 3) - { - if (ss[i].read()) - done = false; - else - ms[i]->drive(0.f); - } + if (ss[i].read()) + done = false; + else + ms[i]->drive(0.f); } } while (!done); @@ -226,16 +222,16 @@ //speed = 1.5f; //speed = 0; //int oldactive = active; - if (pc.readable()){ - int rfSpeed = 0; - pc.scanf("%d %d %d", &rfSpeed, &dir, &turn); - speed = rfSpeed/10.0f; - if (speed >= 10) - speed = speed - (((int)(speed/10))*10); - else if (speed <= 0.25f) - speed = float(0); - } - pc.printf("%.2f %d%d\n",speed,dir,turn); + //if (pc.readable()){ + int rfSpeed = 0; + pc.scanf("%d %d %d", &rfSpeed, &dir, &turn); + if (rfSpeed > 50){ + rfSpeed = rfSpeed-(rfSpeed - rfSpeed/10); + } + speed = rfSpeed/10.0f; + if (speed <= 0.5f) + speed = float(0); + pc.printf("%d %.2f\n",rfSpeed,speed); if (speed != 0){ //for (int i = 0; i < MOTORS; i++)