#include <Servo.h>
Servo myservo;
int potVal;
int moires;
void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
pinMode(7,OUTPUT);
pinMode(10,OUTPUT);
myservo.attach(10);
}
void loop()
{
potVal = analogRead(A0);
moires = map(potVal, 0, 1023, 0, 180);
Serial.println(moires);
myservo.write(moires);
digitalWrite(7,HIGH);
delay(potVal);
digitalWrite(7,LOW);
delay(potVal);
}
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου