Example Code for micro:bit-MakeCode-Send Message to Twitter (IFFTT)
when you get up in the morning, press down button A and B, send the temperature and light intensity to Twitter.
Hardware Preparation
- micro:bit board: Quantity 1
- Micro: IoT expansion board: Quantity 1
- IFFTT platform access: Quantity 1
- Twitter account: Quantity 1
Software Preparation
- Makecode online graphical programming platform: https://makecode.microbit.org/
- Micro:IoT library: https://github.com/DFRobot/pxt-microIoT
- How to install an library?
- IFFTT account: https://ifttt.com
Wiring Diagram
Plug the micro:bit board into the Micro: IoT expansion board.
Other Preparation Work
-
- Enter IFFTT website, register an account: https://ifttt.com
-
- Sign in and enter the My Applets page, click New Applets.
-
- Create an Applet: click This, input webhooks, fill the Event Name as "Twitter".
-
- Click That, search Twitter, select "post a tweet", complete the action fields.
Sample Code
Makecode Programs: Send message to Twitter
Result
press down button A, send the message to Twitter: Hi DFROBOT and the current temperature; Press down button B, send: HI DFROBOT,and the current light intensity.
Was this article helpful?
