Advertisement
Guest User

Remain in Motion API

a guest
Oct 30th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.95 KB | None | 0 0
  1. local motorSide = "right"
  2. function info()
  3. -- For directions, 0 is down, 1 is up, 2 is north (-Z), 3 is south (+Z), 4 is west (-X), and 5 is east (+X).
  4. -- For the simulation flag, true is simulate (don't actually move anything) and false is don't simulate (actually move the carriage).
  5. -- For the anchoring flag, true is the controller will stay where it is, and false is move the controller with the carriage.
  6. -- If the command is not issued with correct syntax, or
  7. -- if the carriage is somehow obstructed or malformed, an error1 will be printed;
  8. -- If the carriage is not configured properly, the return code will be "false" and a plain-English error1 message;
  9. -- If the carriage is obstructed, the return code will be "false", a plain-English error1 message, and the X/Y/Z coordinates of the obstruction;
  10. -- Otherwise, the return code will be "true".
  11.  
  12. --drive=peripheral.wrap("left")
  13. --drive.move(3,false,true)
  14.  
  15. --peripheral.call(motorSide,"move",2,false,false)
  16. end
  17.  
  18. function north()
  19.         p=peripheral.wrap(motorSide)
  20.         peripheral.call(motorSide,"move",2,false,false)
  21.         --2
  22.         --drive.move(2,false,false)
  23. end
  24.  
  25. function east()
  26.         p=peripheral.wrap(motorSide)
  27.         peripheral.call(motorSide,"move",5,false,false)
  28.         --5
  29.         --drive.move(5,false,false)
  30. end
  31.  
  32. function south()
  33.         p=peripheral.wrap(motorSide)
  34.         peripheral.call(motorSide,"move",3,false,false)
  35.         --3
  36.         --drive.move(3,false,false)
  37. end
  38.  
  39. function west()
  40.         p=peripheral.wrap(motorSide)
  41.         peripheral.call(motorSide,"move",4,false,false)
  42.         --4
  43.         --drive.move(4,false,false)
  44. end
  45.  
  46. function down()
  47.         p=peripheral.wrap(motorSide)
  48.         peripheral.call(motorSide,"move",0,false,false)
  49.         --0
  50.         --drive.move(5,false,false)
  51. end
  52.  
  53. function up()
  54.         p=peripheral.wrap(motorSide)
  55.         peripheral.call(motorSide,"move",1,false,false)
  56.         --1
  57.         --drive.move(6,false,false)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement