Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ‘Code for Sorting Robot, Robot 11
  2. Program will pick up blocks coming from conveyor
  3. and sort them to designated area depending on their visible letter
  4. Program by Tyler Funk, Richard Schoellhammer, Ethan Bressler
  5.  
  6. MCount = 0
  7. HOpen 1
  8. Mov P1
  9. GoSub *ConnectCognex ‘subroutine used to connect cognex
  10. While MCount = 0
  11. EBRead #1, ,M, U, ANGLE1, ANGLE2 ‘read and name the desired output string
  12. If M = 0 And U = 0 And M_In(14) = 0 Then
  13. GoTo *ReRead
  14. EndIf
  15. If M = 1 And M_In(14) = 1 Then ‘conditional for detecting M on block and block in position
  16. P3.C = -Rad(-ANGLE1 - 12) ‘calibrated from output string to reorient block while placing
  17. Mov P2, +60move 60mm above position where blocks are expected
  18. Mov P2
  19. Dly 0.1
  20. HClose 1
  21. Dly 0.1
  22. Mov P2, +120
  23. Mov P3, +120move 120 mm above position where Ms are placed
  24. Mov P3
  25. Dly 0.1
  26. HOpen 1
  27. Mov P3, +60
  28. EndIf
  29. If U = 1 And M_In(14) = 1 Then ‘conditional for detecting U on block and block in position
  30. Dly 0.1
  31. P4.C = -Rad(-ANGLE2 - 98) ‘calibrated from output string to reorient block while placing
  32. Dly 0.5
  33. Mov P2, +60
  34. Mov P2
  35. Dly 0.1
  36. HClose 1
  37. Dly 0.1
  38. Mov P2, +120
  39. Mov P4, +120move 120mm above position where Us are placed
  40. Mov P4
  41. Dly 0.1
  42. HOpen 1
  43. Mov P4, +60
  44. EndIf
  45. If M = 0 And M_In(14) = 1 Then
  46. EndIf
  47. If U = 0 And M_In(14) = 1 Then
  48. EndIf
  49. WEnd
  50. *ReRead
  51. Dly 0.5
  52. End
  53. *ConnectCognex ‘connects to cognex program
  54. If M_NvOpen(1) <> 1 Then
  55. Dly 0.1
  56. NVOpen "COM2:" As #1
  57. EndIf
  58. Wait M_NvOpen(1) = 1
  59. NVRun #1, "SortCam1" ‘finds the program to open
  60. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement