Seguidor De Linea Con 3 Sensores.docx

  • Uploaded by: Eyver Subia
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Seguidor De Linea Con 3 Sensores.docx as PDF for free.

More details

  • Words: 178
  • Pages: 3
//crear varaibles para poder leer lecturas de los sensores con INT //void setup es para declarar pines digitales, y con analogicos no entrar a void setup //CONTROL PARA LAS RUEDAS, LOS PWM SON ANALOGICOS. //con los analogicos son con tiempos para controlar velocidades con delay y con analogWrite. esto en los pines PWM // const int ri1=5; const int ri2=6; const int rd1=10; const int rd2=11; const int si=13; const int sm=8; const int sd=7; int lsi=0; int lsm=0; int lsd=0; void setup() { pinMode(ri1,OUTPUT); pinMode(ri2,OUTPUT); pinMode(rd1,OUTPUT); pinMode(rd2,OUTPUT); pinMode(si,INPUT); pinMode(sm,INPUT); pinMode(sd,INPUT); } void loop(){

lsi=digitalRead(si); lsm=digitalRead(sm); lsd=digitalRead(sd); if(lsi==0 && lsm==0 && lsd==0){ digitalWrite(ri1,LOW); digitalWrite(ri2,LOW); digitalWrite(rd1,LOW); digitalWrite(rd2,LOW); } if(lsi==0 && lsm==0 && lsd==1){ digitalWrite(ri1,HIGH); digitalWrite(ri2,LOW); digitalWrite(rd1,LOW); digitalWrite(rd2,LOW); } if(lsi==0 && lsm==1 && lsd==0){ digitalWrite(ri1,HIGH); digitalWrite(ri2,LOW); digitalWrite(rd1,HIGH); digitalWrite(rd2,LOW); } if(lsi==0 && lsm==1 && lsd==1){ digitalWrite(ri1,HIGH); digitalWrite(ri2,LOW); digitalWrite(rd1,LOW); digitalWrite(rd2,HIGH);

} if(lsi==1 && lsm==0 && lsd==0){ digitalWrite(ri1,LOW); digitalWrite(ri2,LOW); digitalWrite(rd1,HIGH); digitalWrite(rd2,LOW); } if(lsi==1 && lsm==0 && lsd==1){ digitalWrite(ri1,LOW); digitalWrite(ri2,LOW); digitalWrite(rd1,LOW); digitalWrite(rd2,LOW); } if(lsi==1 && lsm==1 && lsd==0){ digitalWrite(ri1,LOW); digitalWrite(ri2,HIGH); digitalWrite(rd1,HIGH); digitalWrite(rd2,LOW); } if(lsi==1 && lsm==1 && lsd==1){ digitalWrite(ri1,LOW); digitalWrite(ri2,LOW); digitalWrite(rd1,LOW); digitalWrite(rd2,LOW); } }

Related Documents


More Documents from ""