diff --git a/arduino/MQTT/MQTT.ino b/arduino/MQTT.ino similarity index 100% rename from arduino/MQTT/MQTT.ino rename to arduino/MQTT.ino diff --git a/arduino/MQTT/certificate.h b/arduino/certificate.h similarity index 100% rename from arduino/MQTT/certificate.h rename to arduino/certificate.h diff --git a/arduino/motor_shield_one/makefile b/arduino/motor_shield_one/makefile deleted file mode 100644 index 20edaf1..0000000 --- a/arduino/motor_shield_one/makefile +++ /dev/null @@ -1,4 +0,0 @@ -ESP_ROOT = $(HOME)/esp8266 -BOARD = d1 - -include $(HOME)/makeEspArduino/makeEspArduino.mk diff --git a/arduino/motor_shield_one/motor_shield_one.ino b/arduino/motor_shield_one/motor_shield_one.ino deleted file mode 100644 index a2dd58e..0000000 --- a/arduino/motor_shield_one/motor_shield_one.ino +++ /dev/null @@ -1,118 +0,0 @@ -//libraries -#include -#include - -//motors -const int C_HEAD = 1; -const int C_FEED = 2; - -int head_speed = 150; -int feed_speed = 150; - -Adafruit_MotorShield AFMS = Adafruit_MotorShield(); - -Adafruit_DCMotor *headMotor = AFMS.getMotor(C_HEAD); -Adafruit_DCMotor *feedMotor = AFMS.getMotor(C_FEED); - -//OSCWiFi -const char* ssid = "XPUB"; -const char* pwd = "5fff132d"; -const IPAddress esp_ip(192, 168, 1, 100); -const IPAddress gateway(192, 168, 1, 1); -const IPAddress subnet(255, 255, 255, 0); -const String tidal = "192.168.1.202"; -const int recv_port = 7000; - -void setup(){ - Serial.begin(115200); - WiFi.mode(WIFI_STA); - WiFi.begin(ssid, pwd); - WiFi.config(esp_ip, gateway, subnet); - while (WiFi.status() != WL_CONNECTED) { - Serial.print('.'); - delay(500); - }; - - if (!AFMS.begin()) { // here for pwm - Serial.println("Could not find Motor Shield. Check wiring."); - while (1); - }; - - Serial.println(""); - Serial.println("WiFi connected."); - Serial.print("IP address: "); - Serial.println(WiFi.localIP()); - Serial.print("ESP CPU Frequency in MHz: "); - Serial.println(ESP.getCpuFreqMHz()); - - headMotor->setSpeed(head_speed); - headMotor->run(RELEASE); - feedMotor->setSpeed(feed_speed); - feedMotor->run(RELEASE); - - OscWiFi.subscribe(recv_port, "/stopall", - [](const OscMessage& m) { - feedMotor->run(RELEASE); - headMotor->run(RELEASE); - } - ); - - OscWiFi.subscribe(recv_port, "/feed/direction", - [&](const String& direction) { - if (direction == "f" || direction == "forward" || direction == "forwards" || direction == "forth"){ - Serial.println("Feed motor direction: forward"); - feedMotor->run(FORWARD); - } else if (direction == "b" || direction == "backward" || direction == "backwards" || direction == "back") { - Serial.println("Feed motor direction: backward"); - feedMotor->run(BACKWARD); - } else if (direction == "s" || direction == "stop" || direction == "r" || direction == "release" || direction == "rel") { - Serial.println("Feed motor direction: release"); - feedMotor->run(RELEASE); - } else { - Serial.println("Don't know what to do with this OSC message."); - } - } - ); - - OscWiFi.subscribe(recv_port, "/feed/speed", - [&](const int& speed) { - feed_speed = speed; - Serial.print("Feed motor speed: "); - Serial.print(feed_speed); - Serial.println(); - feedMotor->setSpeed(speed); - } - ); - - OscWiFi.subscribe(recv_port, "/head/direction", - [&](const String& direction) { - if (direction == "f" || direction == "forward" || direction == "forwards" || direction == "forth"){ - Serial.println("Head motor direction: forward"); - headMotor->run(FORWARD); - } else if (direction == "b" || direction == "backward" || direction == "backwards" || direction == "back") { - Serial.println("Head motor direction: backward"); - headMotor->run(BACKWARD); - } else if (direction == "s" || direction == "stop" || direction == "r" || direction == "release" || direction == "rel") { - Serial.println("Head motor direction: release"); - headMotor->run(RELEASE); - } else { - Serial.println("Don't know what to do with this OSC message."); - } - } - ); - - OscWiFi.subscribe(recv_port, "/head/speed", - [&](const int& speed) { - head_speed = speed; - Serial.print("Head motor speed: "); - Serial.print(head_speed); - Serial.println(); - headMotor->setSpeed(head_speed); - } - ); -} - -void loop(){ - OscWiFi.update(); -} - diff --git a/arduino/MQTT/readme.md b/arduino/readme.md similarity index 100% rename from arduino/MQTT/readme.md rename to arduino/readme.md diff --git a/arduino/secret.h b/arduino/secret.h new file mode 100644 index 0000000..97fba70 --- /dev/null +++ b/arduino/secret.h @@ -0,0 +1,15 @@ +#define VITRINE_SSID "Schuurneusiphone" +#define VITRINE_WIFI_PASS "12345678" +#define MQTT_ARDUINO_USERNAME "vitrinekast" +#define MQTT_ARDUINO_PASS "cA8nngp8oNbG9Pxg" +#define hasMotorshield false +#define hasRelayShield true +#define arduinoName "power-arduino" +#define isESP true + +// The digital pins on which your relay shield is connected. +#define PIN_FAN1 1 +#define PIN_FAN2 2 +#define PIN_RADIO1 3 +#define PIN_LAMP1 4 +#define PIN_LAMP2 5 \ No newline at end of file