Features :
สามารถตั้งเวลาเครื่องในการเทอาหารให้กับสุนัข-แมวตามเวลาที่ต้องการแบบอัตโนมัติหรือจะกดสั่งงานด้วยตัวเองให้เครื่องทำงาน ได้ทุกที่ทุกเวลาผ่านแอพปลิเคชั่นมือถือ
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example runs directly on NodeMCU.
Note: This requires ESP8266 support package:
https://github.com/esp8266/Arduino
Please be sure to select the right NodeMCU module
in the Tools -> Board menu!
For advanced settings please follow ESP examples :
- ESP8266_Standalone_Manual_IP.ino
- ESP8266_Standalone_SmartConfig.ino
- ESP8266_Standalone_SSL.ino
Change WiFi ssid, pass, and Blynk auth token to run :)
Feel free to apply it to any other example. It's simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "TEMPLATE_ID"
#include
#include
#include
#include
// ####################### What you need to modify #####################
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "BLYNK_TOKEN";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "WIFI_SSID";
char pass[] = "WIFI_PASSWORD";
// #####################################################################
BLYNK_WRITE ( MANUAL_FEED )
{
int val = param.asInt(); // assigning incomming value from pin to a var
// #####################################################################
BLYNK_WRITE ( CLEAR_FEED )
{
int val = param.asInt(); // assigning incomming value from pin to a var
if ( val )
{
fish_feed_count = 0;
Blynk.virtualWrite(LCD_LINE_2, fish_feed_count);
Blynk.virtualWrite(FEED_COUNT, fish_feed_count);
}
}
// #####################################################################
BLYNK_WRITE (REPEAT_1)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_feed_repetition_set(0, val);v
}
// #####################################################################
BLYNK_WRITE (REPEAT_2)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_feed_repetition_set(1, val);
}
// #####################################################################
BLYNK_WRITE (REPEAT_3)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_feed_repetition_set(2, val);
}
// #####################################################################
BLYNK_WRITE (EN_TIMER_1)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_timer_en_set(0, val);
}
// #####################################################################
BLYNK_WRITE (EN_TIMER_2)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_timer_en_set(1, val);
}
// #####################################################################
BLYNK_WRITE (EN_TIMER_3)
{
int val = param.asInt(); // assigning incomming value from pin to a var
blynk_timer_en_set(2, val);
}
if (t.hasStartTime() )
{
start_hr = t.getStartHour();
start_min = t.getStartMinute();
week_day = 0;
for (int i = 1; i <= 7; i++)
{
if (t.isWeekdaySelected(i)) // will be "TRUE" if nothing selected as well
week_day |= (0x01 << (i-1));
}
blynk_timer_set(2, start_hr, start_min, week_day);
}
else
{
Serial.println("Disabled Timer 3");
}
}
// #####################################################################
BLYNK_WRITE( InternalPinRTC )
{
const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
unsigned long blynkTime = param.asLong();