i was trying to code Arduino Nano to control servo motor using IR Sensor. my code is as follows
#include <Servo.MG996R>
int sensor_pin=7;
int tap_servo_pin=6;
int val;
void setup() {
pinMode(sensor_pin. INPUT),
tap_servo.attach(tap_servo_pin);
}
void loop() {
val= digitalRead(sensor_pin);
if (val=0)
(tap_sensor.write(0));
if (val=1)
(tap_servo.write(85))
}
The project is to create self controlled tap, a tap that will recognize hand and then turn, when the hand is no longer there then return back to its position.
the following error were shown when i try compiling it
/tmp/497281337/Self_Controlled_Water_Tap/Self_Controlled_Water_Tap.ino:1:24: fatal error: Servo.MG996R: No such file or directory
#include <Servo.MG996R>
int sensor_pin=7;
int tap_servo_pin=6;
int val;
void setup() {
pinMode(sensor_pin. INPUT),
tap_servo.attach(tap_servo_pin);
}
void loop() {
val= digitalRead(sensor_pin);
if (val=0)
(tap_sensor.write(0));
if (val=1)
(tap_servo.write(85))
}
^
compilation terminated.
exit status 1