Reader small image

You're reading from  Design Innovative Robots with LEGO SPIKE Prime

Product typeBook
Published inJan 2022
PublisherPackt
ISBN-139781801811576
Edition1st Edition
Concepts
Right arrow
Author (1)
Aaron Maurer
Aaron Maurer
author image
Aaron Maurer

Aaron Maurer, also known as “Coffeechug” is the STEM lead for 21 school districts in Iowa helping to expand STEM, Computer Science, Makerspace, and Purposeful Play into classrooms K-12. Aaron is also a former FIRST LEGO League coach for 8 years with much success working with phenomenal kids. He has a Master Educator License with endorsements in 5-12 Psychology – 163; 5-12 World History – 166; 5-12 American History – 158; 5-12 Computer Science – 278; PK-12 Talented and Gifted – 107; 5-8 Middle School Generalist – 182; and K-8 Computer Science – 277. Currently, Aaron is a member of ISTE Making It Happen Award; Lego Education Ambassador and Master Educator; PBS Digital Innovator and All-Star; PITSCO Tag Committee; Microsoft Innovator Educator Expert; Microsoft Innovative Educator Fellow; Global Learning Mentor (formerly Skype Master Teacher); Minecraft Global Mentor; and Makey Makey Ambassador. Finally, Aaron was a finalist for the Iowa Teacher of the Year in 2014.
Read more about Aaron Maurer

Right arrow

Writing the code

The code for the mechanical bird will use the ultrasonic sensor as both the eyes and to trigger movement. The goal is to mimic a bird in flight looking for prey, so we will work to ensure the legs move with the head gesture as well as the wing mechanics.

The ports

You will connect the ultrasonic sensor into port B. You will plug the large motor into port F. You will plug the two medium motors into ports C and D.

Figure 4.35 – Port view in the software

Calibrating the motors

This first code stack will make sure that the head and wing motors are all set to position 0 before being activated to ensure everything works smoothly and properly:

  1. Under the when program starts block, insert a purple light up block that activates the lights on ultrasonic sensor B lighting up to 0 0.
  2. Add a pink movement block named set movement speed to and make it 15%.
  3. Add a blue set speed to motor block, set it to 10%, and change it to...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Design Innovative Robots with LEGO SPIKE Prime
Published in: Jan 2022Publisher: PacktISBN-13: 9781801811576

Author (1)

author image
Aaron Maurer

Aaron Maurer, also known as “Coffeechug” is the STEM lead for 21 school districts in Iowa helping to expand STEM, Computer Science, Makerspace, and Purposeful Play into classrooms K-12. Aaron is also a former FIRST LEGO League coach for 8 years with much success working with phenomenal kids. He has a Master Educator License with endorsements in 5-12 Psychology – 163; 5-12 World History – 166; 5-12 American History – 158; 5-12 Computer Science – 278; PK-12 Talented and Gifted – 107; 5-8 Middle School Generalist – 182; and K-8 Computer Science – 277. Currently, Aaron is a member of ISTE Making It Happen Award; Lego Education Ambassador and Master Educator; PBS Digital Innovator and All-Star; PITSCO Tag Committee; Microsoft Innovator Educator Expert; Microsoft Innovative Educator Fellow; Global Learning Mentor (formerly Skype Master Teacher); Minecraft Global Mentor; and Makey Makey Ambassador. Finally, Aaron was a finalist for the Iowa Teacher of the Year in 2014.
Read more about Aaron Maurer