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

Arduino Tecno

Uploaded by

M Lafuente
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Arduino Tecno

Uploaded by

M Lafuente
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

int sensorValue;

const int ledPin = 7;


const int sensorLuz = 3;

void setup ()
{
pinMode (ledPin, OUTPUT);
pinMode (sensorLuz, INPUT);
Serial.begin(9600);
Serial.println("comienza el programa");
pinMode (9, OUTPUT) ;
}

void loop ()
{

sensorValue = digitalRead(sensorLuz);
Serial.println("E sensor esta a ");
Serial.println(sensorValue);

if (sensorValue == 1)
{
digitalWrite(ledPin, HIGH);
Serial.println("enciendo el led");
tone(9, 392,400);
delay(400);
tone(9, 102,400);
delay(400);
tone(9, 245,400);
delay(400);
tone(9, 342,400);
delay(400);
}
else
{
digitalWrite(ledPin, LOW);
digitalWrite(9, HIGH);
Serial.println("apago el led");

Arduino:1.8.19 (Windows Store 1.8.57.0) (Windows 10), Tarjeta:"Arduino Mega or Mega


2560, ATmega2560 (Mega 2560)"

You might also like