Documente Academic
Documente Profesional
Documente Cultură
v=-f6FthqPwog
https://www.youtube.com/watch?v=EOn00FPWwU4
https://www.youtube.com/watch?v=iP--u0uvrIM
https://www.youtube.com/watch?v=yDxCCJ1NwGs
https://www.youtube.com/watch?v=vXLIAEKDnPI
https://www.youtube.com/watch?v=HnwTqx-INes
https://www.youtube.com/watch?v=GsNCz97pkmw
- Un Arduino
- Un shield (es opcional)
- 4 Resistencias LDR (fotoceldas)
- 2 Servo motores
- 4 Resistencias de 10k Ohm
- Cables
void loop()
{
int lt = analogRead(ldrlt); // top left (superior izquierdo)
int rt = analogRead(ldrrt); // top right (superior derecho)
int ld = analogRead(ldrld); // down left (inferior izquierdo)
int rd = analogRead(ldrrd); // down rigt (inferior derecho)
if (-1*tol > dvert || dvert > tol) // revisar la diferencia para cambiar al
angulo vertical
{
if (avt > avd)
{
servov = ++servov;
if (servov > servovLimitHigh)
{
servov = servovLimitHigh;
}
}
else if (avt < avd)
{
servov= --servov;
if (servov < servovLimitLow)
{
servov = servovLimitLow;
}
}
vertical.write(servov);
}
if (-1*tol > dhoriz || dhoriz > tol) // revisar la diferencia para cambiar
al angulo horizontal
{
if (avl > avr)
{
servoh = --servoh;
if (servoh < servohLimitLow)
{
servoh = servohLimitLow;
}
}
else if (avl < avr)
{
servoh = ++servoh;
if (servoh > servohLimitHigh)
{
servoh = servohLimitHigh;
}
}
else if (avl = avr)
{
}
horizontal.write(servoh);
}
delay(dtime);