1 / 12

Radio communication between two micro:bits

Radio communication between two micro:bits. It is possible to send messages between two micro:bits. This opens a range of possibilities, one of which being making one micro:bit control the other.

garibay
Télécharger la présentation

Radio communication between two micro:bits

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Radio communication between two micro:bits

  2. It is possible to send messages between two micro:bits. This opens a range of possibilities, one of which being making one micro:bit control the other.

  3. This tutorial will walk you through setting up one micro:bit to control the other in a Kitronik buggy.

  4. Controls • Using the accelerometer will allow you to tilt your controller micro:bit forwards and backwards to make the buggy drive forwards and reverse, and use the buttons to turn the buggy.

  5. Language • The language used will be one called PXT IO. • This is a block version of JavaScript made by Microsoft, available at https://www.pxt.io/

  6. How to communicate in PXT • PXT has a category called Radio. • Docs can be found at https://m.pxt.io/--docs#doc:reference/radio

  7. How to communicate in PXT • The first step is to make sure that both micro:bits are in the same group. Both .hex files must start with this block and use the same number between 0-255

  8. How to communicate in PXT • The sender can now send numbers to the receiver

  9. Message Sender • I send one of three numbers: • 10000 for left • 20000 for right • The value of the accelerometer (In the Z Axis) for forwards/ backwards/ stop

  10. Message Receiver • The logic to drive the buggy happens in the receiver. • I set a variable called “number” to the number received over radio and then use nested ifs to act depending what number it is.

  11. Message Receiver • If the number is between -100 and 100 i.e. the micro:bit is relatively vertical all pins will turn off (stop buggy)

  12. Buggy Pins

More Related