Blinds control, question about code


#1

So first thing - love the blinds control. I ordered one prefab and then built several more and they’ve been great. I do have a question about a bit of code in the Arduino sketch. There’s a check for if the MQTT command is between 40 and 60, and if so it sets the servo to 0 before changing to whatever value was sent in

if(msgString.toInt() <= 60 && msgString.toInt() >= 40)
{
  myservo.write(0);               
  delay(1000);  
}
myservo.write(msgString.toInt() * 1.8);              
delay(1000);  

On my setup I basically open the blinds to 50%, always. The esp8266 reboots every now and then and this bit of code causes the blinds to close and re-open on reboot. Not a big deal, just curious as to the need and why its only for commands between 40 and 60.


#2

Hello,

Sorry for the late reply. The reason the code has the in between 40 and 60 is that the blinds are not evenly made so one side is heavier than the other. So if you went to 50 from 100 then it will not be half but if it goes from 0 to 50 then it will be half. I hope that made sense if not let me know.


#3

Ah gotcha that makes sense. I’m basically always at either 0 or 50 on mine so I’ll probably take out that code so randomly closing and opening blinds will stop terrifying my wife :smiley: