#include <Servo.h>
Servo s1;
int val;
int val2;
int val3;
void setup() {
s1.attach(6);
pinMode(3, OUTPUT);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(8, INPUT);
Serial.begin(1200);
}
void loop() {
servo();
mov();
int val = analogRead(A0);
int v = map (val, 0, 1023, 0, 180);
s1.write(v);
//Serial.println(v);
//Serial.println(val);
}
void mov(){
val2 = analogRead(A1);
if(val2>=1000){
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
}
else if(val2<=400){
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
}
else if(val2<= 1000 and val2>=400){
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
}
void servo(){
val2 = analogRead(A1);
int val = analogRead(A0);
int v = map (val, 0, 1023, 0, 180);
}
void horn(){
val3 = digitalRead(8);
if(val3 == 1)
{
digitalWrite(3, HIGH);
}}
Which error ?
Works for me.
I'll try to guess:
"servo.h: No such file or directory" ???
1 Like
It seems to compile....
If there is a error message could you post it?
Thanks.
I can´t see any errors.
The compiler provides some warnings, that´s.
1 Like
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.