Advertisement
Erfinator

motor calibration

Dec 24th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /* 6 Wheel Calibration
  2. *
  3. * Use this sketch to calibrate the wheels in your robot.
  4. * Your robot should drive as straight as possible when
  5. * putting both motors at the same speed.
  6. *
  7. * Run the software and follow the on-screen instructions.
  8. * Use the trimmer on the bottom board to make sure the
  9. * robot is working at its best!
  10. *
  11. * (c) 2013 X. Yang
  12. */
  13. #include "scripts_library.h"
  14.  
  15. #include <ArduinoRobot.h>
  16. #include <Wire.h>
  17. #include <SPI.h>
  18.  
  19. void setup(){
  20. Serial.begin(9600);
  21. Robot.begin();
  22. Robot.beginTFT();
  23. Robot.beginSD();
  24.  
  25. Robot.setTextWrap(false);
  26. Robot.displayLogos();
  27.  
  28. writeAllScripts();
  29.  
  30. }
  31. void loop(){
  32. int val=map(Robot.knobRead(),0,1023,-255,255);
  33. Serial.println(val);
  34. Robot.motorsWrite(val,val);
  35.  
  36. int WC=map(Robot.trimRead(),0,1023,-20,20);
  37. Robot.debugPrint(WC,108,149);
  38. delay(40);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement