Previous                                    Tutorial                                  Tutorial

Authorized Online Retailers:

Purchase from US         Purchase from Japan



In this lesson, we will show how to use the Osoyoo Yun IoT Kit with the Blynk APP to remote control a buzzer.





Build the circuit as below:

Here we connect the buzzer i/o pin to digital pin D7.

Buzzer Osoyoo Mega2560+Yun Shield

Code Program

After above operations are completed, make sure that the Yun Shield is on the same network with the computer. Open the Arduino IDE and choose corresponding board type and port type for you project. Then load up the following sketch onto your Arduino.

#define BLYNK_PRINT Console
#include "Bridge.h"
#include "Console.h"
#include "BlynkSimpleYun.h"

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
void setup()
// Debug console
while (!Console);{}
// You can also specify server:
//Blynk.begin(auth, "", 8442);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8442);
void loop()
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!

In this example sketch, find this line:

char auth[] =”YourAuthToken”;

This is the Auth Token that you emailed yourself. Please check your email and copy it, then paste it inside the quotation marks.

It should look similar to this:

char auth[] = “f45626c103a94983b469637978b0c78a”;

Upload the sketch to the board. Wait until you see something like this:

avrdude done.  Thank you.

Congrats! You are all set! Now your hardware is connected to the Blynk Cloud!

Add a Widget

Your project canvas is empty, let’s add a button to control the buzzer.

Tap anywhere on the canvas to open the widget box. All the available widgets are located here. Now pick a button.

Widget Box

Drag-n-Drop – Tap and hold the Widget to drag it to the new position.

Widget Settings – Each Widget has it’s own settings. Tap on the widget to get to them.

The most important parameter to set is PIN . The list of pins reflects physical pins defined by your hardware. If your buzzer is connected to Digital Pin 7 – then select D7 (D – stands for Digital).

Running Result

After you finished all above operations, open the Serial Monitor, then open the Blynk APP, press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOP and get back to EDIT mode.

At the same time, press the button, you can hear the buzeer beep.

Previous                                    Tutorial                                  Tutorial