Documentos de Académico
Documentos de Profesional
Documentos de Cultura
cdigo:
#include <Servo.h>
#include <LiquidCrystal.h>
Servo Servojara;
Servo Servojara2;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
double x;
double y;
double a1=10;
double a2=10;
void setup()
{
lcd.begin(16, 2);
lcd.print("grados th1, th2");
Serial.begin(9600);
Servojara.attach(9);
Servojara2.attach(10);
}
void loop() {
lcd.setCursor(0, 1);
int th1 = analogRead(A15);
th1 = map(th1, 0 ,1018, 0, 180);
Servojara.write(th1);
int th2 = analogRead(A0);
th2 = map(th2, 0 ,1023, 0, 180);
Servojara2.write(th2);
x=((a1*(cos(th1)))+(a2*(cos(th1+th2))));
y=((a1*(sin(th1)))+(a2*(sin(th1+th2))));
Serial.print ("valor de x,y: (");
Serial.print (x);
Serial.print (", ");
Serial.print (y);
Serial.print (")");
Serial.print ("valor de pot1,pot2: (");
Serial.print (th1);
Serial.print (", ");
Serial.print (th2);
Serial.println (")");
delay(500);
lcd.print(th1);
lcd.print(",");
lcd.println(th2);
}