Saturday, February 24, 2018

B2B Lab: WeDo 2.0 Parallel Coding...

Here's Danny's first WeDo 2.0 car... 

To run his car, instead of just adding programming blocks in one line of code, he actually used three lines of code - parallel coding. If he had put all of it in one line of code, the vehicle would pause while waiting for, let's say play sound, to finish executing before continuing to move. Now, in the LEGO Education WeDo 2.0 Curriculum Pack parallel coding can be done by using the Send Message, and Start On Message blocks. However, Daniel had not learned those blocks yet, so he invented his own way of doing parallel coding.

By doing this he was able to have the vehicle perform 3 functions at the same time - in this case: movement, color change, & sound. Cool!

To run the above 3 Loop programs, use three finger to tap on all 3 Start blocks at the same time or quickly tap on each Start on each.

Another way of parallel coding is to use the Message blocks:

If you like a little challenge, you can also write a code that has WAIT for Time at the beginning of the programs so that you have time to tap each Start individually. The program below is without Loops so it will run just once. The challenge is getting all to start and end at the same time - test your programming skills!

There are various ways of coding, explore the possiblilites...


No comments:

Post a Comment