Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
et:arduino [2015/12/21 09:20] kaupo.raidet:arduino [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 12: Line 12:
 ====== Viited ====== ====== Viited ======
  
-[[http://itead-europe.com/pm/platform/shield/1602%20lcd%20shield/SCH_IM120417018_Arduino1602LCDShield.pdf|LCD Shield datasheet]]+[[http://itead-europe.com/pm/platform/shield/1602%20lcd%20shield/SCH_IM120417018_Arduino1602LCDShield.pdf|LCD Shield datasheet]]\\
 [[http://www.sharpsma.com/webfm_send/1489|Sharp 10-80cm analoog andur]] [[http://www.sharpsma.com/webfm_send/1489|Sharp 10-80cm analoog andur]]
  
Line 451: Line 451:
  
 Protokollis tähistab „x“ kohaliku seadme numbrit, mille annab juhendaja igale tiimile erineva. Protokollis tähistab „x“ kohaliku seadme numbrit, mille annab juhendaja igale tiimile erineva.
 +
 +
 +===== Lihtne roboti navigatsioon =====
 +
 +<code c>
 +#include <Servo.h> 
 +Servo right_motor,left_motor;  // create servo object to control a servo 
 + 
 +void setup() 
 +
 +  // Viktoriiniküsimus - mida see plokk teeb?
 +  digitalWrite(9, HIGH); // lülitame sisemised pullup takistid sisse
 +  while (digitalRead(9)==1){}; 
 +  
 +  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>
et/arduino.1450689609.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