Skip to Content
Hands-On ROS for Robotics Programming
book

Hands-On ROS for Robotics Programming

by Bernardo Ronquillo Japón
February 2020
Intermediate to advanced
432 pages
10h 50m
English
Packt Publishing
Content preview from Hands-On ROS for Robotics Programming

LEDs and blinkers

There are two LEDs on top of the board that simulate GoPiGo3's eyes. By running the following block of code, they will change their color:

colors = [ (255,0,0), (255,255,0), (255,255,255), (0,255,0), (0,255,255), (0,0,255), (0,0,0)]for color in colors:    GPG.set_eye_color(color)    GPG.open_eyes()    time.sleep(0.5)

The blinkers are two small red LEDs underneath the red board at the front. The following code makes them blink 5 times:

for i in range(5): GPG.led_on("left") GPG.led_on("right") time.sleep(0.5) GPG.led_off("left") GPG.led_off("right") time.sleep(0.5)

Check it visually, and be aware that no message appears in the console.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ROS for Robotics Programming

Mastering ROS for Robotics Programming

Lentin Joseph
ROS Robotics By Example - Second Edition

ROS Robotics By Example - Second Edition

Lentin Joseph, Carol Fairchild, Dr. Thomas L. Harman

Publisher Resources

ISBN: 9781838551308Supplemental Content