Paso 3: Pieza de Software:
#include < Wire.h >
#include < LiquidCrystal_I2C.h >
Lcd(0x27,16,2) de LiquidCrystal_I2C;
int Led = 13;
int sinyalpin = 3;
int val;
int buzzerpin = 10;
void setup)
{
LCD.init();
LCD.Backlight();
LCD.Print("Dedector");
pinMode (buzzerpin, salida);
pinMode (Led, salida);
pinMode (sinyalpin, entrada);
digitalWrite(buzzerpin,HIGH);
}
void loop)
{
Val = digitalRead (sinyalpin);
Si (val == HIGH) {lcd.setCursor (0, 1);
LCD.Print ("Manyetik yok");
digitalWrite (Led, baja);
digitalWrite(buzzerpin,HIGH);
}
otra cosa
{
lcd.setCursor (0, 1);
LCD.Print ("Manyetik var");
BEEP(500); digitalWrite (Led, alta);
}
}
anular el pitido (unsigned char delayms)
{
analogWrite (10, 255);
Delay(delayms);
analogWrite (10, 150);
Delay(delayms);
}