Air Vent servo control
The air vent subproject is part of the Ikea Lack enclosure, more exact to the Air vent or the temperature control. The idea is simple; the vents will be open and close with by a servo, the decision to open or close the vents depending on the current temperature inside the enclosure.
The project is based on Servo automated iris/aperture for airflow control by AcE_Krystal
First Sketch (Basic Control)¶
First, we are going to create a sketch to control the servo. It will move 180 degrees right, later 180 left.
The code will be as follow:
- We are going to import the library
#include <Servo.h>
- we are going to give a name to the servo, in this case, "servo_air_vent"
Servo servo_air_vent;
- we define the initial position
int servo_position = 0;
- in the
setup
block we tell Arduino where the servo is connectedServo_Air_vent.attach (9);
- In the
loop
block we create 2for
that will move the servo to the right and later to the left