Arduino
Arduino
int led=13;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led,HIGH);
delay(1500);
digitalWrite(led,LOW);
delay(200 0);
}
****************programa2*******************JOYSTYCK
int led=13;
int potx = A0;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
pinMode(potx,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int lectura = analogRead(potx);
analogWrite(led,lectura);
}
**********acelerometro********
int
int
int
int
led=13;
x = A0;
y = A1;
z = A2;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int lecturaX = analogRead(x);
int lecturaY = analogRead(y);
int lecturaZ = analogRead(z);
Serial.print("\n");
Serial.print("Eje X =");
Serial.print(lecturaX);
Serial.print("\t");
Serial.print("Eje Y =");
Serial.print(lecturaY);
Serial.print("\t");
Serial.print("Eje Z =");
Serial.print(lecturaZ);
Serial.print("\t");
Serial.print("\t");
delay(500);
}
************