Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ‘Code for Sorting Robot, Robot 11
- ‘Program will pick up blocks coming from conveyor
- ‘and sort them to designated area depending on their visible letter
- ‘Program by Tyler Funk, Richard Schoellhammer, Ethan Bressler
- MCount = 0
- HOpen 1
- Mov P1
- GoSub *ConnectCognex ‘subroutine used to connect cognex
- While MCount = 0
- EBRead #1, ,M, U, ANGLE1, ANGLE2 ‘read and name the desired output string
- If M = 0 And U = 0 And M_In(14) = 0 Then
- GoTo *ReRead
- EndIf
- If M = 1 And M_In(14) = 1 Then ‘conditional for detecting M on block and block in position
- P3.C = -Rad(-ANGLE1 - 12) ‘calibrated from output string to reorient block while placing
- Mov P2, +60 ‘move 60mm above position where blocks are expected
- Mov P2
- Dly 0.1
- HClose 1
- Dly 0.1
- Mov P2, +120
- Mov P3, +120 ‘move 120 mm above position where Ms are placed
- Mov P3
- Dly 0.1
- HOpen 1
- Mov P3, +60
- EndIf
- If U = 1 And M_In(14) = 1 Then ‘conditional for detecting U on block and block in position
- Dly 0.1
- P4.C = -Rad(-ANGLE2 - 98) ‘calibrated from output string to reorient block while placing
- Dly 0.5
- Mov P2, +60
- Mov P2
- Dly 0.1
- HClose 1
- Dly 0.1
- Mov P2, +120
- Mov P4, +120 ‘move 120mm above position where Us are placed
- Mov P4
- Dly 0.1
- HOpen 1
- Mov P4, +60
- EndIf
- If M = 0 And M_In(14) = 1 Then
- EndIf
- If U = 0 And M_In(14) = 1 Then
- EndIf
- WEnd
- *ReRead
- Dly 0.5
- End
- *ConnectCognex ‘connects to cognex program
- If M_NvOpen(1) <> 1 Then
- Dly 0.1
- NVOpen "COM2:" As #1
- EndIf
- Wait M_NvOpen(1) = 1
- NVRun #1, "SortCam1" ‘finds the program to open
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement