Reader small image

You're reading from  Build and Code Creative Robots with LEGO BOOST

Product typeBook
Published inNov 2021
PublisherPackt
ISBN-139781801075572
Edition1st Edition
Concepts
Right arrow
Author (1)
Ashwin Shah
Ashwin Shah
author image
Ashwin Shah

Ashwin Shah is an Electronics and Communication engineer from India. Teaching is his passion and he started working at the tender age of 16 as a doubt solver for younger kids at after-school classes. Today, he is a successful edupreneur who runs his own STEM-based robotics, coding, and IoT institute - RoboFun Lab. Being one of the pioneers of STEM education in India, he has taught over 3000 students and trained 200+ educators thus far. He has trained 100+ teams for prestigious STEM competitions with 50+ national and 12+ international awards in the bag. Most of his students are now pursuing careers/education in STEM at prominent universities. Ashwin was a state-level badminton player during his college days.
Read more about Ashwin Shah

Right arrow

Let's code the robot to sort different colored LEGO bricks

Let's now sort the LEGO bricks with this color sorting robot. First, find out the number of rotations needed by the external motor to do the following:

  1. Knock LEGO brick to the left tray:______________ rotations.
  2. Knock LEGO brick to the right tray:_____________ rotations.
  3. Allow LEGO brick to pass through at the blue tray:_____________ rotations.

Ensure that the hitter comes back to the original position after knocking the LEGO brick. The hitter is connected to port C and the conveyor belt is connected to port A.

Activity #1

Place a red LEGO brick on the belt. Now, move the belt until the color sensor senses this brick. Display the brick color on the screen. Now, move it further until it reaches a proper knocking position. Knock it to the left tray.

The sample code for this task is given here:

Figure 11.51 – Sample code

Let's repeat the same process...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Build and Code Creative Robots with LEGO BOOST
Published in: Nov 2021Publisher: PacktISBN-13: 9781801075572

Author (1)

author image
Ashwin Shah

Ashwin Shah is an Electronics and Communication engineer from India. Teaching is his passion and he started working at the tender age of 16 as a doubt solver for younger kids at after-school classes. Today, he is a successful edupreneur who runs his own STEM-based robotics, coding, and IoT institute - RoboFun Lab. Being one of the pioneers of STEM education in India, he has taught over 3000 students and trained 200+ educators thus far. He has trained 100+ teams for prestigious STEM competitions with 50+ national and 12+ international awards in the bag. Most of his students are now pursuing careers/education in STEM at prominent universities. Ashwin was a state-level badminton player during his college days.
Read more about Ashwin Shah