

Label=text(text=str(temp),color=color.white,pos=vector(-2,tickPos-3,0),height=.3) Marble.pos=vector(marbleX,marbleY,marbleZ) If marbleX+marbleR>(roomX/2-wallT/2) or marbleX-marbleR(roomY/2-wallT/2) or marbleY-marbleR(roomZ/2-wallT/2) or marbleZ-marbleR<(-roomZ/2+wallT/2): Marble=sphere(color=ballColor,radius=marbleR) RightWall=box(size=vector(wallT,roomY,roomZ),pos=vector(roomX/2,0,0),color=wallColor,opacity=wallOpacity)īackWall=box(size=vector(roomX,roomY,wallT),pos=vector(0,0,-roomZ/2),color=wallColor,opacity=wallOpacity)įrontWall=box(size=vector(roomX,roomY,wallT),pos=vector(0,0,roomZ/2),color=wallColor,opacity=frontOpacity) LeftWall=box(size=vector(wallT,roomY,roomZ),pos=vector(-roomX/2,0,0),color=wallColor,opacity=wallOpacity) M圜eiling=box(size=vector(roomX,wallT,roomZ),pos=vector(0,roomY/2,0),color=wallColor,opacity=wallOpacity) And executing turns if directed to do so by the turn signs.MyFloor=box(size=vector(roomX,wallT,roomZ),pos=vector(0,-roomY/2,0),color=wallColor,opacity=wallOpacity) If all is working well, the robot will skillfully follow the line, beeping when it sees an intersection or a barcode. You can print the turn signs, cut them out and use them to direct your robot to execute turns at intersections (like in the video) if you like. After initializing, Pixy2 should turn on its lamp and look down (with its tilt axis) and start following the line. Place the robot on the line that you drew and turn it on. When drawing curves, try to make the curves have a radius no smaller than 10 inches. On a large piece of paper, or several pieces of paper taped together, draw an oval or a figure-8 with a black marker. Once the Pixy2 library is installed, you can find the line_zumo_demo program in File➜Examples➜Pixy2 from the Arduino IDE. The line_zumo_demo program is part of the Pixy Arduino library which you can find here. Upload the line_zumo_demo program into the Arduino by plugging your Arduino into your computer's USB port and running the Arduino IDE. If you haven't tried the chase demo (described above), we recommend running it first to test and possibly debug your robot. The line demo is a fun demo – the same one shown in the Pixy2 Youtube video. Don't forget to insert batteries and turn the Zumo power switch on before running the test. Make sure the Zumo motors move as described in the above program.

#Arduino drawing vector code driver
The Zumo's power switch and LEDs are at the back of the Zumo, so the imaginary driver will face opposite (looking away from) the power switch and LEDs.

Left, right, forward and reverse are with respect to an imaginary (and tiny) driver-person sitting on the Zumo and facing forward.
#Arduino drawing vector code install
Install the Pixy2 Arduino library if you haven't already. Note, the files ZumoMotors.h and ZumoBuzzer.h are part of the Pixy2 Arduino library (found here). Below is a simple Arduino program you can cut and paste into the Arduino IDE. After you assemble the Zumo base, run a simple Arduino program to test the motors and buzzer.
