Continuing from last lesson. We have the ability to display how much sound there is around the sensor / how loud it is on screen. This isn’t useful when the device is in a sound-proof box for testing, you won’t be able to see the screen. So instead this lesson we will be transmitting a wireless radio signal outside the box to another micro-bit to view the sensors readings.
Radio signals are a form of what is called “Electro-magnetic Radiation”, which includes X-Rays, Ultraviolet, Visible Light (What makes up all the colours that you can see), Infa-red (TV Remotes) and of course Radio signals.
The micro-bit encodes messages as a series of Radio-waves, which are sent/received using the micro-bits in-built antenna, and are sent at a specific frequency (How fast the waves go up and down over time).
The radio-waves themselves look something like this.
You will require two microbits for this, one connected to the circuit from last week. The other on its own with a power pack. You will need to have paired both micro-bits to your iPad.
The one connected to the circuit will require this code.
You will find the pink radio blocks under radio. The red analog read-pin block will be found under Advanced -> Pins.
The next microbit (the one on its own), will require code similar to last week.
Again you will find the pink radio blocks under Radio. The purple “plot bar graph of” block under LED and the “Minus (-)” block in Math. The change this time is that you will instead of having the analog read pin P1 on the left hand side of the minus block, you will instead drag the “receivedNumber” variable out from the “on radio received” block directly.