The OSOYOO Magic I/O Shield for Arduino is a powerful board for the beginners. With this Magic board, we can easily connect various sensors and actuators much easier than before.
In this lesson, you will learn how to program Arduino and control a SG90 servo motor rotate back and forth.
First, please plug Osoyoo Magic I/O shield into UNO board:
Then connect the servo motor to the D9 port of the Magic I/O shield (please move the switch on the board to 5V) as below:
After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.
Open the Graphical Programming software Mixly, if Mixly is not English, you should change the language first:
You can download the code directly, then click “Open” in Mixly to choose the code you download:
Or you can do as following operations:
Drag out the servo control module from “Actuator”, and fit with “setup” block.
“Servo Control Module” description:
Drag out the servo control module from “Actuator”, edit the parameter as the picture shows:
Make the servo rotate to a certain angle. At this part, we control the servo motor rotate 90 degrees (rotate once every 15 degrees).
And then rotate in the opposite direction.
The whole program blocks are as following:
After programming, you can click the “<" button to check the corresponding code on the right bar. After above operations are completed, do as follows:
A few seconds after the upload finishes, you should now see the servo motor rotate 90 degrees (rotate once every 15 degrees). And then rotate in the opposite direction.
DownLoad Url osoyoo.com