The program connects to mqtt server, and subscrive to sunRise
If it receives a message "1" a servo will start to move a sun up to a maximum
If 0 it will reduce the angle up to zero.
*/
#include<ESP8266WiFi.h>
#include<PubSubClient.h>
#include<Arduino.h>
#include<Servo.h>
//NETWORK STUFF
constchar*ssid="Mittelab_Members_Legacy";// The SSID (name) of the Wi-Fi network you want to connect to. cause everybody knows what ssid is and people do not read long comments "dickbutt"
constchar*password="******";// The password of the Wi-Fi network
constchar*mqtt_server=" mqtt.hq.mittelab.org";
constchar*clientID="ESPsun";
WiFiClientESPclient;
PubSubClientclient(ESPclient);
// SUN ACTIVATION STUFF
boolsunFlag=false;
unsignedlongpreviousMillis=0;
//SERVO STUFF
intservoPin=2;// Declare the Servo pin
ServoServo1;// Create a servo object
unsignedintmaxAng=90;// Servo max angle
unsignedintservoAng=0;// Current angle in degree for servo
unsignedintservoWaitUp=1000;//the time needed to move 1 degree up in milliseconds
unsignedintservoWaitDown=100;//the time needed to move 1 degree down in milliseconds