Iot hranilica za kućne ljubimce
Udruga informatičara grada PožegeVideo snimka
Izrada projekta
Mobilna aplikacija
Shema projekta
Arduino program
#define #define BLYNK_PRINT SerialUSB #include #include #include #include Servo s1; int d1; char auth[] = "d9d63849cc754836b8455854e2effdfe"; char ssid[] = "64-filip"; char pass[] = "filipstreb"; int a=1; bool def; bool rt; bool mfd; bool mwd; int food; int water; int t=2000; int dt=millis(); BLYNK_WRITE(V0){ def = param.asInt(); } BLYNK_WRITE(V1){ rt = param.asInt(); } BLYNK_WRITE(V2){ mfd = param.asInt(); } BLYNK_WRITE(V3){ mwd = param.asInt(); } BLYNK_WRITE(V4){ food = param.asInt(); } BLYNK_WRITE(V5){ water = param.asInt(); } BLYNK_WRITE(V6){ t = param.asInt(); } //kopirao s blynka void setup() { pinMode(6,OUTPUT); pinMode(7,INPUT); pinMode(8,OUTPUT); pinMode(9,INPUT); Serial.begin(9600); Blynk.begin(auth, ssid, pass); s1.attach(4); s1.write(0); } void loop() { //neka bog i tko god ovo provjerava ima milosti nad mojom dušom Blynk.run(); d1=sensorRead(6,7); if(mfd)s1.write(90); else s1.write(0); if(rt)dt=millis(); if(d1>=0 && d1<=20 && t<=(millis()-dt)/60/60/1000){ for(int i=0;i<=food;i++){ s1.write(90); delay(2000); s1.write(0); dt=millis(); } } } int sensorRead(int trig, int echo){ long duration, distance; digitalWrite(trig, LOW); delayMicroseconds(2); digitalWrite(trig, HIGH); delayMicroseconds(10); digitalWrite(trig, LOW); duration = pulseIn(echo, HIGH); distance= duration*0.034/2; return distance; }
Arduino program ovoga projekta možete preuzeti ovdje.
Autori
Projekt je izradio Filip Jamuljak uz mentorstvo Ljiljane Miletić iz Udruge informatičara grada Požege.
Projekt je prijavljen na temu: Internet of Things: Kućni ljubimci i domaće životinje.