/* Please visit my website: http://nxt.meinblock.eu 03/18/2008 18.03.2008 */ #define ACCURACY 12 task main() { int ua = 0, ub = 0; while(true) { ua = ua + MotorRotationCount(OUT_A); ub = ub + MotorRotationCount(OUT_B); if(ua/ACCURACY > 63) { ua = 63*ACCURACY; SetOutput(OUT_A, RotationCount, 63*ACCURACY); } if(ua < 0) { ua = 0; ResetRotationCount(OUT_A); } if(ub/ACCURACY > 99) { ub = 99*ACCURACY; SetOutput(OUT_B, RotationCount, 99*ACCURACY); } if(ub < 0) { ub = 0; ResetRotationCount(OUT_B); } PointOut(ub/ACCURACY, ua/ACCURACY); ResetRotationCount(OUT_AB); if(ButtonCount(BTN4, false) >= 1) { ClearScreen(); ResetRotationCount(OUT_AB); ButtonCount(BTN4, true); } } }