Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mektory [2016/04/27 13:17] – tekitatud raivo.sellmektory [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +<code c> 
 +#include <Servo.h> 
 +Servo right_motor,left_motor;  // create servo object to control a servo 
 + 
 +void setup() 
 +
 +  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
 +
 +
 +</code>
  
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