Arduino Uno Programacion Ejemplos -

for (pos = 180; pos >= 0; pos--) myservo.write(pos); delay(15);

void loop() // Repeated execution code here

void loop() Serial.print("Value: "); Serial.println(analogRead(A0)); delay(500);

int sensorValue = 0; void setup() Serial.begin(9600);

if (currentMillis - previousMillis >= interval) previousMillis = currentMillis; ledState = !ledState; digitalWrite(ledPin, ledState);

void loop() unsigned long currentMillis = millis();

#include <Servo.h> Servo myservo; int pos = 0;

void setup() pinMode(13, OUTPUT); // Set pin 13 as output

// Other non-blocking code can run here

void loop() Components: Servo motor (e.g., SG90). Connect signal wire to pin 9, power to 5V, ground to GND.

int ledPin = 9; int brightness = 0; int fadeAmount = 5; void setup() pinMode(ledPin, OUTPUT);

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

for (pos = 180; pos >= 0; pos--) myservo.write(pos); delay(15);

void loop() // Repeated execution code here

void loop() Serial.print("Value: "); Serial.println(analogRead(A0)); delay(500);

int sensorValue = 0; void setup() Serial.begin(9600);

if (currentMillis - previousMillis >= interval) previousMillis = currentMillis; ledState = !ledState; digitalWrite(ledPin, ledState);

void loop() unsigned long currentMillis = millis();

#include <Servo.h> Servo myservo; int pos = 0;

void setup() pinMode(13, OUTPUT); // Set pin 13 as output

// Other non-blocking code can run here

void loop() Components: Servo motor (e.g., SG90). Connect signal wire to pin 9, power to 5V, ground to GND.

int ledPin = 9; int brightness = 0; int fadeAmount = 5; void setup() pinMode(ledPin, OUTPUT);

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