Example Code for MakeCode-Sending Email (Based on IFTTT)
This project demonstrates how to connect the WiFi IoT module to the IFTTT platform. When Button A on the micro:bit is pressed, the current temperature and light intensity values are sent to IFTTT, which then triggers an email notification. This allows real-time sharing of environmental data with others.
Hardware Preparation
- micro:bit board x 1
- IO Extender for micro:bit x1
- WiFi IoT module x1
- Wires
Wiring Diagram

Software Preparation
This section mainly introduces how to use the WiFi IoT module and how to program it using MakeCode.
MakeCode Programming Platform:
https://makecode.microbit.org/
I2C Library:
MakeCode I2C Library – DFRobot WiFi IoT
- Configure IoT platform
-
Enter IFTTT website, register an account if you don't have one. Then Sign in.

-
The following interface will appear when you signed in.

-
Click "Create" to enter the interface below.

-
Click "if this" and input "webhooks" in the search bar.


-
The following interface when entering for the first time, click "Receive a web request".

-
Fill in the Event Name, then you have created this.(The event name can be defined by yourself).

-
The webpage will return back automatically. Click "that" and select "Email".

-
Click "Connect", fill in your emial address, and click "send PIN" to send a PIN code to your email box.

-
Check your email to find the PIN code, and fill it in the webpage, then click "Connect".

-
Click "Send me an Email" to set the email.

-
You can write the content to be sent to your email box in the interface below, here we select the default one. Click "Create action".

-
Enter the interface as follows.

-
Check Password: click your avatar, click "My services".

-
Click webhooks to enter the event created.

-
Enter webhooks, click "Documentation" then the password can be seen.


Sample Code
https://makecode.microbit.org/_6r9WkE7Lrfi9
Program Blocks

Result
Press the button A on the micro:bit, the current temperature and light values will be detected and uploaded to IFTTT, and then forward to the mailbox you set.

Was this article helpful?
