In this lesson, we will show how to use the OSOYOO IoT APP to make a remote-controllable ambient light. We can change the color of the light at home through the mobile APP to make more colorful moments.
First, please plug OSOYOO MEGA-IoT Extension Board into MEGA2560 board:
RGB module — RGB port
Prerequisite:
Before you’re running the code, please make sure have already downloaded and installed the following libraries. If you have installed them in lesson 1, please skip this step.
WifiEsp-master library, download link:https://osoyoo.com/driver/WiFiEsp-master.zip
OsoyooIOT Library, Download link: https://osoyoo.com/driver/wifi-iot/OsoyooIOT.zip
Download OSOYOO IoT APP by searching OSOYOO IoT UDP robot car app from Apple Store(iPhone/iPad) or Google Play Store (Android device)
Download and Edit Lesson2-7 Arduino Code
Step 1 Download the code from following link, unzip it:
https://osoyoo.com/driver/smart-home-v2-udp/lesson8/smart-home-lesson8.zip
Step 2 After above operations are completed, connect OSOYOO MEGA2560 Board to PC with USB cable.
Step 3 Open Arduino IDE: Choose corresponding board type and port type for your project.
Step 4 Arduino IDE: Click file – Open, then choose code in the folder, load up the sketch onto your Arduino.
You need to edit the code as following:
**********************************************************
Note: In the sketch, find these code in line 13,14 as following:
In the sketch code and replace *** with your Wi-Fi ssid/password
char ssid[] = "***";//replace this line with your wifi ssid char pass[] = "***"; //replace this line with your wifi password
please replace the *** with your correct wifi SSID and password, otherwise your project can not connect to Internet.
Upload the sketch to the board. Wait until you see the IP address of your Arduino.
Now open your OSOYOO IoT UDP APP (if you don’t have it, search OSOYOO IoT UDP Robot APP in Apple Store or Google Play Store).
Then select Setting icon to set the Arduino IP address as following, click Save button to keep the change.
Now you can change the color of the LED:
press F1 you will turn on RED color, press F5 will turn off RED color
press F2 you will turn on Green color, press F6 will turn off Green color
press F3 you will turn on Blue color, press F7 will turn off Blue color
You can combine these 6 keys and to create different colors.
No. | Picture | Device | Qty. | Link |
1 | OSOYOO MEGA2560 Board | 1 | Click here to buy | |
2 | OSOYOO MEGA-IoT Extension Board | 1 | Click here to buy | |
3 | Photosensitive Sensor | 1 | Click here to buy | |
4 | Temp & Hum Sensor | 1 | Click here to buy | |
5 | OSOYOO Active Buzzer Module | 1 | Click here to buy | |
6 | Flame Detection Sensor | 1 | Click here to buy | |
7 | Fan Motor Module | 1 | Click here to buy | |
8 | Micro Servo Motor | 1 | Click here to buy | |
9 | RGB Module | 1 | Click here to buy | |
10 | Ultrasonic Sensor | 1 | Click here to buy | |
11 | PIR Motion Sensor | 1 | Click here to buy | |
12 | Microphone Module | 1 | Click here to buy | |
13 | 1602 I2C LCD Screen | 1 | Click here to buy | |
14 | RFID Module | 1 | Click here to buy | |
15 | White LED Module | 1 | Click here to buy | |
16 | Red LED Module | 1 | Click here to buy | |
17 | Colorful Light | 1 | Click here to buy | |
18 | Red Button Module | 1 | Click here to buy | |
19 | Blue Button Module | 1 | Click here to buy | |
20 | Philips Screwdriver | 1 | Click here to b |
DownLoad Url osoyoo.com