Arduino Uno Programacion Ejemplos May 2026
if (buttonState == HIGH) digitalWrite(ledPin, HIGH); Serial.println("Button pressed"); else digitalWrite(ledPin, LOW);
void setup() pinMode(13, OUTPUT); // Set pin 13 as output
void loop() analogWrite(ledPin, brightness); brightness = brightness + fadeAmount; arduino uno programacion ejemplos
| Library | Purpose | |---------|---------| | LiquidCrystal.h | Control LCD displays (16x2, 20x4) | | Servo.h | Control up to 12 servos | | Stepper.h | Control stepper motors | | DHT.h | Read temperature/humidity sensors | | SPI.h / Wire.h | SPI and I2C communication | 6. Debugging and Serial Communication The Serial Monitor (Tools → Serial Monitor) is essential for debugging.
void loop() buttonState = digitalRead(buttonPin); if (buttonState == HIGH) digitalWrite(ledPin, HIGH); Serial
void loop() sensorValue = analogRead(A0); // Read 0-1023 Serial.println(sensorValue); // Print to serial monitor delay(100);
const int ledPin = 13; int ledState = LOW; unsigned long previousMillis = 0; const long interval = 1000; // 1 second void setup() pinMode(ledPin, OUTPUT); if (buttonState == HIGH) digitalWrite(ledPin
3.1 Pin Mode and Digital I/O Pins must be configured as INPUT or OUTPUT using pinMode() .