Arduino: LCD + PIR (mugimenduen sensorie)

Denpora asko idatzi barik eta geisorik nauela aprobetza eta mugimentuen sensorie iminjot arduinogaz martxan:

Erreza, sensoriek mobimientue notaten daueniko ba LCD-n idaztentu.

Argazkidxe:
http://img.imgur.com/eZ13N68.jpg

Zirkuituen mapie:
http://img.imgur.com/cAwkAcG.png

Kodigue:

//DFRobot.com
//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include  // 
#include  // 
LiquidCrystal_I2C lcd(0x27, 516,2); // set the LCD address to 0x27 for a 16 chars and 2 line display

// PIR Sensorie 2 PIN digitalien
int motion_1 = 2;
void setup()
{
	lcd.init();
	lcd.backlight();
	// PIR Sensorie
	pinMode (motion_1, INPUT);
}

void loop()
{
	// LCD resetie
	lcd.clear();
	lcd.setCursor(0, 0);
	// PIR Sensorie leidu
	int sensor_1 = digitalRead(motion_1);
	if (sensor_1 == HIGH)
		lcd.print("Mobidu");
	else
		lcd.print("Geldik");
	// 100 milisegundoko deskantsue :D
	delay(100);
}

Bididxue martxan:

Github-en kodigue: https://github.com/ZiTAL/arduino/blob/master/LCD_I2C_PIR/LCD_I2C_PIR.ino

Github-en arduino proiekto osue: https://github.com/ZiTAL/arduino/

Leave a Reply

Your email address will not be published. Required fields are marked *