This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Password.h> | |
#include <Keypad.h> | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
Password password = Password( "1234" ); // Set the Password | |
// Set the LCD address to 0x27 for a 20 chars and 4 line display | |
LiquidCrystal_I2C lcd(0x27, 20, 4); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
Serial.begin(9600); // Define Serial for Debug Sensor & Keyped | |
lcd.begin(); //Define LCD | |
lcd.backlight(); | |
pinMode(status_lock, OUTPUT); // Sets the digital pin as output | |
pinMode(status_unlock, OUTPUT); // Sets the digital pin as output | |
pinMode(led_bed, OUTPUT); // Sets the digital pin as output | |
pinMode(led_bath, OUTPUT); // Sets the digital pin as output | |
pinMode(Buzzer, OUTPUT); // Sets the digital pin as output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//take care of some special events | |
void keypadEvent(KeypadEvent eKey){ | |
switch (keypad.getState()){ | |
case PRESSED: | |
//Serial.print("Pressed: "); | |
//Serial.println(eKey); | |
lcd.setCursor(dir1, 3); | |
lcd.print(test); | |
test = "*"; | |
lcd.setCursor(dir, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void checkPassword(){ // Function check the password | |
if (password.evaluate()){ | |
//Add code to run if it works | |
while(1){ | |
//Serial.println("Success"); | |
fl = 1; | |
digitalWrite(status_lock, LOW); | |
digitalWrite(status_unlock, HIGH); | |
lcd.setCursor(0, 3); | |
lcd.print(" ** Home Unlock ** "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void close_all_power(){ // Function close the light all. | |
digitalWrite(status_lock, HIGH); | |
digitalWrite(status_unlock, LOW); | |
digitalWrite(led_bed, LOW); | |
digitalWrite(led_bath, LOW); | |
} | |
void Alarm(){ // Function Alarm. | |
digitalWrite(Buzzer, HIGH); // Turn on Buzzer | |
delay(100); // delay 100 milliseconds | |
digitalWrite(Buzzer, LOW); // Turn off Buzzer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void motion_on() { // Function Open PIR Motion Sensor. | |
alarmValue = digitalRead(pir); // Read analog sensor 0 or 1. | |
//Serial.println (alarmValue); // Debug Sensor value. | |
if (alarmValue == 0) // Check the value | |
{ | |
Alarm(); | |
} | |
else | |
{ | |
Alarm_off(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 20, 4); | |
#define pHPin A0 //pH meter Analog output to Arduino Analog Input 0 | |
#define turbidityPin A1 //Turbidity Analog output to Arduino Analog Input 1 | |
#define tempPin A2 //Temperature sensor Analog output to Arduino Analog Input 2 | |
#define Offset 0.00 //deviation compensate | |
#define ArrayLenth 40 //times of collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ArduinoMqttClient.h> | |
#include <SPI.h> | |
#include <WiFiNINA.h> | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
LiquidCrystal_I2C lcd(0x27, 20, 4); | |
const char ssid[] = "YOUR_SSID"; | |
const char pass[] = "YOUR_PASSWORD_SSID"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Pixy2.h> | |
#include <PIDLoop.h> | |
#include <ZumoMotors.h> | |
// กำหนดความเร็วสูงสุด (สูงสุด 400) | |
#define MAX_TRANSLATE_VELOCITY 200 | |
Pixy2 pixy; | |
ZumoMotors motors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <avr/pgmspace.h> | |
#include <SPI.h> | |
const byte STCP_PIN = 7; // Latch | |
const byte DS_PIN = 11; // Data In | |
const byte SHCP_PIN = 13; // CLK | |
#define LEDARRAY_D 2 // ขาที่ใช้ในการควบคุมแถวแนวนอน | |
#define LEDARRAY_C 3 // ขาที่ใช้ในการควบคุมแถวแนวนอน |
OlderNewer