2018年5月9日水曜日

Cooperation between micro:bit and MIT App Inventor with Eddystone signals (No.1)


Let's try to collaborate between micro:bit which is currently drawing attention and MIT App Inventor for Android. As one of them, we exchange Eddystone signals. There are several signal configurations of Eddystone, but here we deal with Eddystone-UID and Eddystone-URL among them.

Micro:bit (advertiser) and Android (receiver)


Let's perform the demonstration and watch it.
As a Microbit program, we made it possible to advertise these two types of Eddystone signals.  First, when you press micro: bit button A, it advertises the current pitch (inclination to the horizontal plane) and temperature. In the figure below, you can see that they are being received on the Android screen. That is, at the present time, the pitch of micro: bit is 30 degrees, and the temperature is found to be 26 degrees Celsius.

Pressing buttonA on the Micro:bit makes it advertise two kinds of data

Next, when pressing the micro:bit button B, a certain URL is advertised. On the screen of Android, the received contents are displayed.
Pressing buttonB on the Micro:bit makes it advertise an url of a web page


And soon, the web page for that URL was automatically displayed. In this case, it is a web page about the Akita dogs which became more famous for being given to famous Russian ice figure skater Miss Zagitova (Алина Ильназовна Загитова).
In this case, cheerful “Japanese Akita Dogs” web page is illustrated


Let's see these source programs. The following figure is a micro:bit advertising program. By pressing button A or button B you can issue either Eddysotne-UID or Eddystone-URL.


Eddystone advertising program (micro:bit)

Next is the Android program that receives Eddystone. This is made with MIT App Inventor only. It uses the extensions function for BLE (Bluetooth Low Energy), so it's very easy to write. However, the figure below shows only the essential part. By this alone, it is possible to directly acquire the content of the received data advertised. Thereafter, for example, it is necessary to decode the received URL data and convert it into a character string. It is also necessary to pass it to the Web viewer. All of them can also be written with MIT App Inventor.
Main part of Eddystone receiving program (MIT App Inventor)


please read this related article

Thanks
FoYo

0 件のコメント:

コメントを投稿