Interactions Between Two Microbits & Connect Scratch with Microbit

 



Interactions between two microbits 

To make a project that uses communication between two Microbits, I chose a project from the list, which is called Heartbeat beacon. A heart pattern will show up in a microbit when it receives a string signal from another microbit. 

At the start, I prepared two microbits: one as a receiver, one as a transmitter. They had the same preset code to set the radio set group and radio set transmit power. For the transmitter, there is a forever loop to transmit radio. For the receiver, there is a trigger to show a heart icon when it receives a string signal. 



For fun, I modified the code. After sending a string, the transmitter will send a number. It is still a forever loop. At the same, I added a new code to the receiver, making it react to the number signal showing a smile icon. 





It is interesting to compare Makecode with Javascript. I found it a little bit different from js that I learned before. Here are some guesses based on my knowledge of js:

1. radio & basic are two objects. Basic refers to microbits

2. block names are method names 

3. nested structures are wrapped by (function( ){ })

4. values (numbers, patterns) are arguments 


Connect Scratch with Microbit

Using music extension and microbit extension, I played the Twinkle Twinkle Little Star using a microbit. The code part is super easy. Each button is connected with a sound. Here is the video. 


https://drive.google.com/file/d/1hrXZ5Ou4NXq-th8BtQmNBGYrxhIgDoZ-/view?usp=sharing


Comments

Popular posts from this blog

Scratch Mini-project: Simple MP4 & Remix