ESCALA MUSICAL CON BUZZER Vídeo Código // Pin 13 has an LED connected on most Arduino boards. // give it a name: int buzzer = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(buzzer, OUTPUT); } // the loop routine runs over and over again forever: void loop() { tone(buzzer, 4187); delay(1000); tone(buzzer,2349); delay(1000); tone(buzzer,2637); delay (1000); tone(buzzer,2793); delay(1000); tone(buzzer, 1567); delay(1000); tone(buzzer, 880); delay(1000); tone(buzzer,987); delay(1000); tone(buzzer,1047); delay (5000); }
Práctica del Semáforo Imagen de la disposición de los componentes Código int green = 13; int yellow= 12; int red=11; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(green, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(green, HIGH); digitalWrite(yellow, LOW); digitalWrite(red, LOW); delay(1000); digitalWrite(green, LOW); digitalWrite(yellow, LOW); digitalWrite(red, LOW); delay(500); digitalWrite(green, LOW); digitalWrite(yellow, HIGH); digitalWrite(red, LOW); delay(1000); digitalWrite...
POTENCIÓMETRO Se va a ver mediante la consola el voltaje que entra en un puerto analógico con valores entre 0 y 1024. Código: void setup() { Serial.begin(9600); } void loop() { int valor= analogRead(A0); Serial.println(valor); delay(100); } Vídeo:
Comentarios
Publicar un comentario