0% found this document useful (0 votes)
31 views

Arduino

arduino

Uploaded by

roblitz06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Arduino

arduino

Uploaded by

roblitz06
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

****************program1*********************

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);
}
************

You might also like