Bluetooth Access Control | MindPlus Coding Kit for Arduino Started Tutorial E23

0 3976 Easy
projectImage

In the previous course, we learned to control the LED and other actuators using mobile phone Bluetooth. In this section, we will use phone’s Bluetooth to control the rotation of the servo to make an access control.

projectImage

Task Navigation 

1. Use the phone app to control the servo.

2. Use phone to turn on and off lights in the house.

Key Points Analysis 

1. Let the app send signals that can control the servo.

In the previous section, we made an app that turns on and off of the LED. It is performed by sending data A and B. Here we can use the app made in the previous section to control the servo action.

2. Adjusting the servo to angles that can successfully open and close the switch panel.

Different switches might have different button sizes, therefore different rotation angles by the servo might be needed. The angles in this chapter are only for reference and you should adjust the angles according to situation.

Hands-On 

Arduino side Programming

1. Write the program

1) Open the "Actuator" and find the servo module and drag it to the program. Change the pin to 10 and the angle to 90 degrees as the switch initial position. At this time, the angle of the servo is that when switch is not pressed.

projectImage

 2.Reference program

projectImage

3. Program effect

After sending the A signal with the phone, the servo turns to 45 degrees; and after sending the B signal, the steering gear turns to 135 degrees. Adjust the switch status by turning the servo.

4. Program analysis

Different switches might have different button sizes, and the servo’s position might vary as well. Therefore, different rotation angles by the servo might be needed.

Further Exercise 

Now that you have mastered the use of the servo, try to apply the servo to other scenarios.

icon Program 10-2 E23.rar 165KB Download(3)
License
All Rights
Reserved
licensBg
0