projector curtain roll wifi by exilaus 3d model
3dmdb logo
Thingiverse
projector curtain roll wifi by exilaus

projector curtain roll wifi by exilaus

by Thingiverse
Last crawled date: 4 years, 4 months ago
2 bearing 608zz
20x20x200 tube alu/pvc
1 servo 360g like md995 moded
esp d1 mini
2 bolt M5 25mm lock bearing and bar.
some line of code :D
include
include
include
include
include
include
Ticker timer;
volatile int interrupts;
Servo myservo;
using namespace std;
// ESP-12F(WeMos D1 mini)
//////////////////////
// WiFi Definitions //
//////////////////////
const char WiFiAPPSK[] = "your password";
const char WiFiname[] = "your ssid";
/////////////////////
// Pin Definitions //
/////////////////////
WiFiServer server(80);
void ICACHE_RAM_ATTR onTimer(){
myservo.detach();
timer1_write(2500000);
}
void setup()
{ Serial.begin(115200);
timer1_attachInterrupt(onTimer);
timer1_enable(TIM_DIV16, TIM_EDGE, TIM_SINGLE);
timer1_write(2500000);
myservo.attach(2);
myservo.detach();
Serial.println("Starting...");
WiFi.begin(WiFiname, WiFiAPPSK);
delay(3000);
MDNS.begin("tenda");
server.begin();
digitalWrite(BUILTIN_LED,HIGH);
}
const int NBSTEPS = 4095;
int Step = 0;
void loop()
{ yield();
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
yield();
// Read the first line of the request
String req = client.readStringUntil('\r');
Serial.println(req);
client.flush();
yield();
if (req.indexOf("/up") != -1) {
myservo.attach(2);
myservo.write(20);
}
if (req.indexOf("/down") != -1) {
myservo.attach(2);
myservo.write(110);
}
if (req.indexOf("/stop") != -1) {
digitalWrite(BUILTIN_LED,HIGH);
myservo.detach();}
client.flush();
delay(20);
yield();
// Prepare the response. Start with the common header:
String s = "HTTP/1.1 200 OK\r\n";
s += "Content-Type: text/html\r\n\r\n";
s += "\r\n\r\n\r\n\r\n.block { display: block; width: 100%; height: 90px; border: none; background-color: #4CAF50; color: white; padding: 14px 28px; font-size: 28px; cursor: pointer; text-align: center;}\r\n";
s += ".block:hover { background-color: #ddd; color: black;}\r\n\r\n\r\n\r\n";
s += "Tenda 1.0

Tags