Advertisement
karelvysinka

turtla autopilot

Nov 1st, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. print("Zakladni program GPS")
  2.  
  3. -- cil programu:
  4. -- umet dojet na urcene misto
  5. -- umet nacitat prikazy pres wifi
  6. -- umet nakrmit hladovou Turtlu :)
  7.  
  8.  
  9. --start
  10. --cilove souradnice:
  11. xc = -128
  12. yc = 65
  13. zc = 252
  14.  
  15. --zjisteni aktualni polohy
  16. local x,y,z = gps.locate(5)
  17. print(x)
  18. print(y)
  19. print(z)
  20.  
  21. -- vzlet nahoru jako do Japonska
  22. for y = 1,15,1 do
  23.   turtle.up()
  24.   print("Turtla jede nahoru patro:")
  25.   print(y)
  26. end
  27.  
  28. while true do
  29.  
  30. -- porovnani polohy
  31. if xc > x then
  32. --   xc = xc -1
  33.    turtle.back()
  34. end
  35.  
  36. if xc < x then
  37. turtle.forward()
  38. end
  39.  
  40. --if yc > y then
  41. --turtle.up()
  42. --end
  43.  
  44. --if yc < y then
  45. --turtle.down()
  46. --end
  47.  
  48. if zc > z then
  49. turtle.turnLeft()
  50. turtle.forward()
  51. turtle.turnRight()
  52. end
  53.  
  54. if zc < z then
  55. turtle.turnRight()
  56. turtle.forward()
  57. turtle.turnLeft()
  58. end
  59.  
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement