Adrian's Color Sorting Robotic Arm

This is the same robotic arm but I added a color sensor to sort the legos by color. I had to add new procedures to make the color sensor work. It took me about one week to finaly make the color sensor to sort the legos by red and blue to pick up the legos from the chute. It picks up the legos 4 times, puts the blue legos in the blue bin, and puts the red legos in the red bin. Below is a picture of my robotic arm and its procedures.

TO PLACE.DISTANT
PICK.FROM.CHUTE
HAND.CLOSE
TALKTO "MOTORA SETRIGHT
ON
WAITUNTIL[ANGLE5 < -60]
OFF
HAND.OPEN
END

TO PLACE.LOCAL
PICK.FROM.CHUTE
HAND.CLOSE
TALKTO "MOTORA SETRIGHT
ON
WAITUNTIL[ANGLE5 < -50]
OFF
HAND.OPEN TO PICK.FROM.CHUTE
TALKTO "MOTORA SETLEFT
ON
WAITUNTIL[ANGLE5 > 0]
OFF
END

TO HAND.OPEN
TALKTO "MOTORB SETLEFT
ONFOR 3
END

TO HAND.CLOSE
TALKTO "MOTORB SETRIGHT
ONFOR 5
END

TO PLACE.ALL
PLACE.LOCAL
PLACE.DISTANT
PLACE.LOCAL
END

TO PLACE.BY.COLOR
PICK.FROM.CHUTE
HAND.CLOSE
TALKTO "MOTORA SETRIGHT
ON
WAITUNTIL [ANGLE5 = -27]
OFF
WAIT 10
CHECK.COLOR
END

TO CHECK.COLOR
IF LIGHT8 >= 43[RED]
IF LIGHT8 < 43[BLUE]
END

TO BLUE
TALKTO "MOTORA SETRIGHT
ON
WAITUNTIL[ANGLE5 = -62]
OFF
HAND.OPEN
END

TO RED
TALKTO "MOTORA SETRIGHT
ON
WAITUNTIL[ANGLE5 = -50]
OFF
HAND.OPEN
END

TO PLACE.COLOR
REPEAT 4[PLACE.BY.COLOR]
END

Vina Danks home page || student lego projects