0% found this document useful (0 votes)
48 views2 pages

Arduino

The document contains three Arduino programs: the first blinks an LED, the second reads a joystick input to control LED brightness, and the third reads accelerometer values on three axes and prints them to the serial monitor. Each program includes setup and loop functions typical for Arduino sketches. The programs demonstrate basic input/output operations and serial communication.

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)
48 views2 pages

Arduino

The document contains three Arduino programs: the first blinks an LED, the second reads a joystick input to control LED brightness, and the third reads accelerometer values on three axes and prints them to the serial monitor. Each program includes setup and loop functions typical for Arduino sketches. The programs demonstrate basic input/output operations and serial communication.

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

****************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