This is an old revision of the document!


#include <Servo.h> 
Servo right_motor,left_motor;  // create servo object to control a servo 
 
void setup() 
{ 
  digitalWrite(9, HIGH); // lülitame sisemised pullup takistid sisse
  while (digitalRead(9)==1){}; // Question - What this row does?
  right_motor.attach(11);  // Attaches the servo on pin 11 
  left_motor.attach(12);  // Attaches the servo on pin 12
} 
 
void loop() 
{ 
 
  // Compare it with reference
  if (digitalRead(10)==0) { // If TRUE
     left_motor.write(0);  // Reverse one motor
     delay(750); // Wait until turn is enough
   }
    right_motor.write(0);    // Drive forward
    left_motor.write(180);   // Drive forward
 
} 
mektory.1461752276.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0