Robot Sumo Arduino (Programación)

November 5, 2017 | Author: Washington Quevedo | Category: N/A
Share Embed Donate


Short Description

Es la programación en la placa Arduino de un Robot prototipo del tipo Sumo. Usa un sensor Ultrasónico que detecta al rob...

Description

#include Servo servito; int echoPin = 2; int initPin = 3; int int int int

SS4Pin=A0; SS1Pin=A1; SS3Pin=A2; SS2Pin=A3;

int int int int

S4Pin=0; S1Pin=0; S3Pin=0; S2Pin=0;

int int int int

MOTDaPin=10; MOTDbPin=11; MOTIaPin=13; MOTIbPin=12;

// SRF05 echo pin (digital 2) // SRF05 trigger pin (digital 3) // // // //

cuadrante cuadrante cuadrante cuadrante

4 1 3 2

int i=0; unsigned long pulseTime = 0; onds unsigned long distance = 0; unsigned long distancia = 50; int angulo=0; int sentido=0; int LED = 8; in 8

// stores the pulse in Micro Sec

// Red LED, connected to digital PWM p

long ultrasonico(){ digitalWrite(initPin, HIGH); delayMicroseconds(10); urning off digitalWrite(initPin, LOW); pulseTime = pulseIn(echoPin, HIGH); hould be high as the pulse goes low-high-low distance = pulseTime/58; convert to cm. return (distance); }

// send 10 microsecond pulse // wait 10 microseconds before t // stop sending the pulse // Look for a return pulse, it s // Distance = pulse time / 58 to

void localizacion(){ distancia=ultrasonico(); leerSensor(); while(distancia>=20&&S1Pin
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF