Buy from US | Buy from UK | Buy from DE | Buy from IT | Buy from FR | Buy from ES | ここでご購入を! |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
In previous lessons, we have showed how to use web browser to access Board through Internet. In these examples, we used a protocol called HTTP.
In this lesson, we will teach you to UDP protocol again. We will use a cell phone APP to control the rotation angle of a servo motor.
First, please insert the ESP8266 wifi Shield into your mainboard,
OSOYOO basic board | Servo Wire |
GND | Brown |
3.3V | RED |
D9 | Orange |
Step A) Install latest IDE from https://www.arduino.cc/en/Main/Software?setlang=en. If you have IDE version after 1.1.16, please skip this step).
Step B) Download PWMServo library zip file from https://osoyoo.com/driver/sg90car/PWMServo.zip
Then in your IDE ->Sketch->Include Library->Add .ZIP Library and select these two zip files you just downloaded, and upload it to IDE.
Step C) Connect the OSOYOO Basic board to computer via USB cable,
Step D) Open the IDE and choose corresponding board type and port type for you project.
Step E) Download sample code from
https://osoyoo.com/driver/wifi-iot/lesson6/wifi-lesson6.zip
unzip the file and double click the wifi-lesson6.ino file, find following lines:
char ssid[] = "******"; // your network SSID (name) char pass[] = "******"; // your network password
please replace the ****** with your correct wifi SSID and password, otherwise your project can not connect to Internet.
Step F) After change above lines, load the sketch into IDE.
Step G)Open your Serial Monitor, you can see your router will assign an IP address to your IDE as following:
In above result, you can see my IP address is 192.168.1.81, UDP port 8888 , we will put this IP in Cell Phone APP Setting in next step .
Step H) Open your OSOYOO IOT UDP Robot APP , If you haven’t installed this APP, please read APP installation section in Lesson 2
Step I)Make sure your Cell phone is in the same Local Network of Arduino. Open the APP, click Settings, enter your Arduino IP address from Step F and Port to 8888 in settings:
You can see the comments in above code and understand the control logic.
DownLoad Url osoyoo.com