W domu zawitał jakiś czas temu szczeniak. Jedyną opcja aby nie stracić mieszkania
Na początku wymyśliłem że będą to chrupki z takiego podajnika:
https://www.thingiverse.com/thing:3051036
Ale sie to nie spisało bo chrupki znikały w mikrosekundach i potwór wracał do zjadania swojego posłania.
(moge dać kod jak ktoś chętny bo obsługiwał on 3 przyciski w zależości od ilości karmy, mozna wykorzystac go też np. do karmienia rybek
Także teraz zbudowałem coś takiego: Umieszczone na skraju szawki kuchennej perfekcyjnie zrzuca czy to ucho wieprzowe czy skóre baranią
Projekt w wersji alpha ale wszystko działa
W działaniu:

Elementy to: NodeMCU + Silnik 28byj-48-5v-uln2003 + druk 3D
W ustawieniach 8 sekund daje pełny ruch spychacza
Do uzupełnienia - WIFI, GUID, AUTHKEY, SERVER, EMAIL
Code: Select all
#include <SuplaDevice.h>
#include "Stepper_28BYJ_48.h"
#include <supla/control/roller_shutter.h>
// Motor pin definitions:
#define motorPin1 5 // IN1 on the ULN2003 driver
#define motorPin2 4 // IN2 on the ULN2003 driver
#define motorPin3 14 // IN3 on the ULN2003 driver
#define motorPin4 12 // IN4 on the ULN2003 driver
Stepper_28BYJ_48 stepper(motorPin1,motorPin2,motorPin3,motorPin4);
int gpio1 = 1;
int gpio3 = 3;
// Choose where Supla should store roller shutter data in persistant memory
// We recommend to use external FRAM memory
#define STORAGE_OFFSET 100
#include <supla/storage/eeprom.h>
Supla::Eeprom eeprom(STORAGE_OFFSET);
#ifdef ARDUINO_ARCH_AVR
#include <supla/network/ethernet_shield.h>
uint8_t mac[6] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
Supla::EthernetShield ethernet(mac);
#elif defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
#include <supla/network/esp_wifi.h>
Supla::ESPWifi wifi("NAZWAWIFI", "HASLO");
#endif
void setup() {
Serial.begin(115200);
pinMode(gpio1,INPUT_PULLUP);
pinMode(gpio3,INPUT_PULLUP);
// Replace the falowing GUID with value that you can retrieve from https://www.supla.org/arduino/get-guid
char GUID[SUPLA_GUID_SIZE] = {};
// Replace the following AUTHKEY with value that you can retrieve from: https://www.supla.org/arduino/get-authkey
char AUTHKEY[SUPLA_AUTHKEY_SIZE] = {};
Supla::Control::RollerShutter *rs = new Supla::Control::RollerShutter(gpio1, gpio3, false);
SuplaDevice.begin(GUID, // Global Unique Identifier
"svrXX.supla.org", // SUPLA server address
"[email protected]", // Email address used to login to Supla Cloud
AUTHKEY); // Authorization key
SuplaDevice.setName("Feeder");
}
void loop() {
SuplaDevice.iterate();
Feeder();
}
void Feeder() {
if ( digitalRead(gpio1) == LOW ) {
stepper.step(-1);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
if ( digitalRead(gpio3) == LOW ) {
stepper.step(1);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
}
}- Kawałek kodu użytkownika @wojtas567 viewtopic.php?t=4765

