Αναζήτηση αυτού του ιστολογίου

Τρίτη 3 Μαρτίου 2026

servo mechanism ημιτελές

 #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);

}

Link για App Inventor χωρίς λογαριασμό

 http://code.appinventor.mit.edu/login/