Introduction

In this lesson, we will show how to use OSOYOO Wifi UDP APP to control LED.

11

Description:

LEDs – those blinky things. A must have for power indication, pin status, opto-electronic sensors, and fun blinky displays.

This is a pack of basic red, yellow, white and green 5mm LEDs (6 of each) all conveniently packaged in a nice reusable ESD safe bag.

Preparation

Hardware:

Connection

In this lesson,we use D2(GPIO4) to control the led,the connection is as below:

Software:

Software Installation

Upload Sketch

Connect the OSOYOO Basic board to your computer using the USB cable. The green power LED (labelled PWR) should go on. Open the Arduino IDE and select corresponding board type and port type for your OSOYOO Basic board.

Download the sketch file from https://osoyoo.com/driver/nodemcu/nodemcu-led.zip

Unzip above file, replace Line 18,19 with your own wifi SSID and password

Then upload the sketch code to Arduino IDE, you will see the IP address of your NodeMCU board.

In above example, the NodeMCU IP is 192.168.1.81 , please Write down the IP address of your NodeMCU.

APP Installation and Setting

Download OSOYOO IoT APP  by searching OSOYOO iot udp robot car app from Apple Store(iPhone/iPad) or Google Play Store(Android device)

Save NodeMCU IP address into the APP Setting :
1)Open APP, click Setting button in upper right corner

2)Use the NodeMCU IP address  to replace default IP 192.168.1.255

3)keep default port number 8888 without changing

4)Click Save button to save the changes you just made
5)Click Back Arrow to go back APP front UI


Running Result

Now Go back to Home Page of your APP

Press F1 button, the LED will turn ON

In the same time , your Arduino IDE serial monitor will show something similar to following:

Received packet of size 1 from 192.168.1.100:44544
(to 192.168.0.103:8888, free heap = 42072 B)
Contents:
F

Press F2 button, the LED will turn OFF

Received packet of size 1 from 192.168.0.100:44544
    (to 192.168.0.103:8888, free heap = 42072 B)
Contents:
G


Part details

SKU:  DKRK100700

No. Picture Name Link
1 OSOYOO NodeMCU Board  https://osoyoo.store/products/osoyoo-nodemcu-module-usb-c-esp8266-esp-12f-wifi-development-board-with-ch340-for-arduino-ide-micropython-includes-tutorial?variant=41099777638511
2 Servo motor https://osoyoo.store/products/sg90-micro-servo-for-arduino-raspberry-pi-robot?variant=31957821096047
3 LED(6 x White, 6 x Red, 6 x Yellow, 6x Green) https://osoyoo.store/products/led-packs-for-arduino?variant=31957816442991
4 Buzzer https://osoyoo.store/products/piezo-buzzer-module-1pcs?variant=39879251656815
5 Push Button and Hats https://osoyoo.store/products/push-button-and-hats-5pcs?variant=39879253131375
6 Photoresistor(Light Sensor) https://osoyoo.store/products/light-sensor?variant=41099777736815
7 potentiometer(10K lohm adjustable resistor) https://osoyoo.store/products/potentionmeter-10k-adjustable-resistor-3pcs?variant=39879281016943
8 I2C LCD Display (16*2) https://osoyoo.store/products/i2c-1602-lcd-display-module-blue-backlight?variant=41099777933423
9  Temperature&Humidity Sensor Module https://osoyoo.store/products/dht11-temperature-humidity-sensor?variant=41099777998959
10 Resistors https://osoyoo.store/products/osoyoo-electronic-component-kit-total-1390-pcs-led-diodes-30-values-resistors-electrolytic-capacitor-package-ceramic-capacitors-common-diodes-common-transistor?variant=29503912706166
11 4*AA Battery Holder Box https://osoyoo.store/products/battery-box-for-4pcs-aaa-battery?variant=41099778031727
12 4 LED Module https://osoyoo.store/products/4-digit-7-segment-display?variant=41099778064495
13 Stepper Motor +Bridge https://osoyoo.store/products/stepper-motor-with-driver-28byj-48-5v-dc?variant=41099778130031
14 Tlit Sensor Module https://osoyoo.store/products/sw-520d-basic-tilt-switch?variant=41099778162799
15 Infrared Remote Controller https://osoyoo.store/products/infrared-remote-controller-for-arduino-raspberry-pi-microbit-stemmodel-2019011500?variant=31958087532655