Components and supplies
NodeMCU ESP8266 Breakout Board
ELEGOO L298N Dual H Bridge Stepper DC Motor Driver Shield Expansion Development Board
Apps and platforms
Arduino IDE
Project description
Code
untitled
arduino
1#include <ESP8266WiFi.h> 2#include <ESP8266WebServer.h> 3 4const char* ssid = "Lavender"; 5const char* password = "5335921602"; 6 7ESP8266WebServer server(80); 8 9const byte L298N_A_pin = D1; // GPI05 10const byte L298N_A_In1_pin = D2; //GPI04 11const byte L298N_A_In2_pin = D3; //GPI0 12 13const byte L298N_B_In3_pin = D4; // GPI02 14const byte L298N_B_In4_pin = D5; // GPIO14 15const byte L298N_B_pin = D6; //GPI12 16 17const byte Led1_pin = D7; //GPIO13 // Sol Sinyal 18const byte Led2_pin = D8; //GPIO15 // Sag Sinyal 19const byte Led3_pin = D9; //GPIO3 // On Far 20const byte Led4_pin = D10; //GPI01 // Arka Lamba 21const byte Korna_pin = D0; //GPI016 //Korna 22byte SolSinyal = 0; 23byte SagSinyal = 0; 24byte ArkaLamba = 0; 25 26 27 28void motorSpeed(int prmA, byte prmA1, byte prmA2, int prmB, byte prmB1, byte prmB2) 29{ 30 analogWrite(L298N_A_pin,prmA); 31 analogWrite(L298N_B_pin,prmB); 32 33 digitalWrite(L298N_A_In1_pin,prmA1); 34 digitalWrite(L298N_A_In2_pin,prmA2); 35 digitalWrite(L298N_B_In3_pin,prmB1); 36 digitalWrite(L298N_B_In4_pin,prmB2); 37 38} 39 40void handleRoot() { 41 server.send(200, "text/plain", "hello from esp8266!"); 42 } 43 44void handleCar() { 45 String message = ""; 46 int BtnValue = 0; 47 for (uint8_t i = 0; i < server.args(); i++) { 48 if (server.argName(i)=="a") 49 { 50 String s = server.arg(i); 51 BtnValue = s.toInt(); 52 } 53 Serial.println(server.argName(i) + ": " + server.arg(i) + "\ 54"); 55 } 56 57 switch (BtnValue) { 58 case 1: // sola donuş 59 motorSpeed(900,LOW,LOW,1023,HIGH,LOW); 60 SolSinyal = 1; 61 digitalWrite(Led1_pin,HIGH); 62 break; 63 case 2: // düz ileri 64 motorSpeed(1023,HIGH,LOW,1023,HIGH,LOW); 65 SolSinyal = 0; 66 SagSinyal = 0; 67 digitalWrite(Led1_pin,LOW); 68 digitalWrite(Led2_pin,LOW); 69 break; 70 case 3:// saga donuş 71 motorSpeed(1023,HIGH,LOW,900,LOW,LOW); 72 SagSinyal = 1; 73 digitalWrite(Led2_pin,HIGH); 74 break; 75 case 4:// tam sola donuş 76 motorSpeed(900,LOW,HIGH,900,HIGH,LOW); 77 SolSinyal = 1; 78 digitalWrite(Led1_pin,HIGH); 79 break; 80 case 5: // stop 81 motorSpeed(0,LOW,LOW,0,LOW,LOW); 82 SolSinyal = 0; 83 SagSinyal = 0; 84 digitalWrite(Led1_pin,LOW); 85 digitalWrite(Led2_pin,LOW); 86 break; 87 case 6:// 88 motorSpeed(900,HIGH,LOW,900,LOW,HIGH); 89 SagSinyal = 1; 90 digitalWrite(Led2_pin,HIGH); 91 break; 92 case 7://sol geri 93 motorSpeed(900,LOW,LOW,1023,LOW,HIGH); 94 break; 95 case 8:// tam geri 96 motorSpeed(900,LOW,HIGH,900,LOW,HIGH); 97 break; 98 case 9:// sag geri 99 motorSpeed(1023,LOW,HIGH,900,LOW,LOW); 100 default: 101 break; 102 } 103 if (BtnValue > 7) 104 { 105 ArkaLamba = 1; 106 SolSinyal = 1; 107 SagSinyal = 1; 108 digitalWrite(Led1_pin,HIGH); 109 digitalWrite(Led2_pin,HIGH); 110 digitalWrite(Led4_pin,HIGH); 111 } 112 else 113 { 114 ArkaLamba = 0; 115 digitalWrite(Led4_pin,LOW); 116 } 117 118 message += "<html> <head> <title>Gungor yalcin</title><head>"; 119 message += "<body><h3>Wifi Robot Car NodeMCU Web Server</h1>"; 120 message += "<table> "; 121 message += "<tr>"; 122 message += "<td><p><a href=\\"/car?a=1\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">\\\\</button></a></p> "; 123 message += "<td><p><a href=\\"/car?a=2\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">^</button></a></p> "; 124 message += "<td><p><a href=\\"/car?a=3\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">/</button></a></p> "; 125 message += "<tr>"; 126 message += "<td><p><a href=\\"/car?a=4\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\"> < </button></a></p> "; 127 message += "<td><p><a href=\\"/car?a=5\\"><button style=\\"width:100;height:100;font-size:40px;\\" class=\\"button\\">Stop</button></a></p> "; 128 message += "<td><p><a href=\\"/car?a=6\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\"> > </button></a></p> "; 129 message += "<tr>"; 130 message += "<td><p><a href=\\"/car?a=7\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">/</button></a></p> "; 131 message += "<td><p><a href=\\"/car?a=8\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">v</button></a></p> "; 132 message += "<td><p><a href=\\"/car?a=9\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">\\\\</button></a></p> "; 133 message += "</table> "; 134 message += "</body></html>"; 135 server.send(200, "text/html", message); 136 } 137 138void tempSinyal() 139{ 140 if (SolSinyal==1) 141 digitalWrite(Led1_pin,!digitalRead(Led1_pin)); 142 143 if (SagSinyal==1) 144 digitalWrite(Led2_pin,!digitalRead(Led2_pin)); 145 146 if (ArkaLamba==1) 147 digitalWrite(Led4_pin,!digitalRead(Led4_pin)); 148 149} 150 151 152 153void handleNotFound() { 154 String message = "File Not Found\ 155\ 156"; 157 message += "URI: "; 158 message += server.uri(); 159 message += "\ 160Method: "; 161 message += (server.method() == HTTP_GET) ? "GET" : "POST"; 162 message += "\ 163Arguments: "; 164 message += server.args(); 165 message += "\ 166"; 167 for (uint8_t i = 0; i < server.args(); i++) { 168 message += " " + server.argName(i) + ": " + server.arg(i) + "\ 169"; 170 } 171 server.send(404, "text/plain", message); 172} 173 174 175void setup() { 176 177 pinMode(L298N_A_In1_pin,OUTPUT); 178 pinMode(L298N_A_In2_pin,OUTPUT); 179 pinMode(L298N_B_In3_pin,OUTPUT); 180 pinMode(L298N_B_In4_pin,OUTPUT); 181 182 digitalWrite(L298N_A_In1_pin,LOW); 183 digitalWrite(L298N_A_In2_pin,LOW); 184 digitalWrite(L298N_B_In3_pin,LOW); 185 digitalWrite(L298N_B_In4_pin,LOW); 186 187 pinMode(Led1_pin,OUTPUT); 188 pinMode(Led2_pin,OUTPUT); 189 pinMode(Led3_pin,OUTPUT); 190 pinMode(Led4_pin,OUTPUT); 191 192 digitalWrite(Led1_pin,LOW); 193 digitalWrite(Led2_pin,LOW); 194 digitalWrite(Led3_pin,LOW); 195 digitalWrite(Led4_pin,LOW); 196 197 Serial.begin(115200); 198 199 WiFi.mode(WIFI_STA); 200 WiFi.begin(ssid, password); 201 Serial.println(""); 202 while (WiFi.status() != WL_CONNECTED) { 203 delay(500); 204 Serial.print("."); 205 } 206 Serial.println(""); 207 Serial.print("Connected to "); 208 Serial.println(ssid); 209 Serial.print("IP address: "); 210 Serial.println(WiFi.localIP()); 211 212 server.on("/", handleRoot); 213 server.on("/car", handleCar); 214 215server.on("/inline", []() { 216 server.send(200, "text/plain", "this works as well"); 217 }); 218 219 server.onNotFound(handleNotFound); 220 221 server.begin(); 222 Serial.println("HTTP server started"); 223} 224 225void loop() { 226 server.handleClient(); 227}
untitled
arduino
1#include <ESP8266WiFi.h> 2#include <ESP8266WebServer.h> 3 4const char* ssid = "Lavender"; 5const char* password = "5335921602"; 6 7ESP8266WebServer server(80); 8 9const byte L298N_A_pin = D1; // GPI05 10const byte L298N_A_In1_pin = D2; //GPI04 11const byte L298N_A_In2_pin = D3; //GPI0 12 13const byte L298N_B_In3_pin = D4; // GPI02 14const byte L298N_B_In4_pin = D5; // GPIO14 15const byte L298N_B_pin = D6; //GPI12 16 17const byte Led1_pin = D7; //GPIO13 // Sol Sinyal 18const byte Led2_pin = D8; //GPIO15 // Sag Sinyal 19const byte Led3_pin = D9; //GPIO3 // On Far 20const byte Led4_pin = D10; //GPI01 // Arka Lamba 21const byte Korna_pin = D0; //GPI016 //Korna 22byte SolSinyal = 0; 23byte SagSinyal = 0; 24byte ArkaLamba = 0; 25 26 27 28void motorSpeed(int prmA, byte prmA1, byte prmA2, int prmB, byte prmB1, byte prmB2) 29{ 30 analogWrite(L298N_A_pin,prmA); 31 analogWrite(L298N_B_pin,prmB); 32 33 digitalWrite(L298N_A_In1_pin,prmA1); 34 digitalWrite(L298N_A_In2_pin,prmA2); 35 digitalWrite(L298N_B_In3_pin,prmB1); 36 digitalWrite(L298N_B_In4_pin,prmB2); 37 38} 39 40void handleRoot() { 41 server.send(200, "text/plain", "hello from esp8266!"); 42 } 43 44void handleCar() { 45 String message = ""; 46 int BtnValue = 0; 47 for (uint8_t i = 0; i < server.args(); i++) { 48 if (server.argName(i)=="a") 49 { 50 String s = server.arg(i); 51 BtnValue = s.toInt(); 52 } 53 Serial.println(server.argName(i) + ": " + server.arg(i) + "\ 54"); 55 } 56 57 switch (BtnValue) { 58 case 1: // sola donuş 59 motorSpeed(900,LOW,LOW,1023,HIGH,LOW); 60 SolSinyal = 1; 61 digitalWrite(Led1_pin,HIGH); 62 break; 63 case 2: // düz ileri 64 motorSpeed(1023,HIGH,LOW,1023,HIGH,LOW); 65 SolSinyal = 0; 66 SagSinyal = 0; 67 digitalWrite(Led1_pin,LOW); 68 digitalWrite(Led2_pin,LOW); 69 break; 70 case 3:// saga donuş 71 motorSpeed(1023,HIGH,LOW,900,LOW,LOW); 72 SagSinyal = 1; 73 digitalWrite(Led2_pin,HIGH); 74 break; 75 case 4:// tam sola donuş 76 motorSpeed(900,LOW,HIGH,900,HIGH,LOW); 77 SolSinyal = 1; 78 digitalWrite(Led1_pin,HIGH); 79 break; 80 case 5: // stop 81 motorSpeed(0,LOW,LOW,0,LOW,LOW); 82 SolSinyal = 0; 83 SagSinyal = 0; 84 digitalWrite(Led1_pin,LOW); 85 digitalWrite(Led2_pin,LOW); 86 break; 87 case 6:// 88 motorSpeed(900,HIGH,LOW,900,LOW,HIGH); 89 SagSinyal = 1; 90 digitalWrite(Led2_pin,HIGH); 91 break; 92 case 7://sol geri 93 motorSpeed(900,LOW,LOW,1023,LOW,HIGH); 94 break; 95 case 8:// tam geri 96 motorSpeed(900,LOW,HIGH,900,LOW,HIGH); 97 break; 98 case 9:// sag geri 99 motorSpeed(1023,LOW,HIGH,900,LOW,LOW); 100 default: 101 break; 102 } 103 if (BtnValue > 7) 104 { 105 ArkaLamba = 1; 106 SolSinyal = 1; 107 SagSinyal = 1; 108 digitalWrite(Led1_pin,HIGH); 109 digitalWrite(Led2_pin,HIGH); 110 digitalWrite(Led4_pin,HIGH); 111 } 112 else 113 { 114 ArkaLamba = 0; 115 digitalWrite(Led4_pin,LOW); 116 } 117 118 message += "<html> <head> <title>Gungor yalcin</title><head>"; 119 message += "<body><h3>Wifi Robot Car NodeMCU Web Server</h1>"; 120 message += "<table> "; 121 message += "<tr>"; 122 message += "<td><p><a href=\\"/car?a=1\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">\\\\</button></a></p> "; 123 message += "<td><p><a href=\\"/car?a=2\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">^</button></a></p> "; 124 message += "<td><p><a href=\\"/car?a=3\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">/</button></a></p> "; 125 message += "<tr>"; 126 message += "<td><p><a href=\\"/car?a=4\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\"> < </button></a></p> "; 127 message += "<td><p><a href=\\"/car?a=5\\"><button style=\\"width:100;height:100;font-size:40px;\\" class=\\"button\\">Stop</button></a></p> "; 128 message += "<td><p><a href=\\"/car?a=6\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\"> > </button></a></p> "; 129 message += "<tr>"; 130 message += "<td><p><a href=\\"/car?a=7\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">/</button></a></p> "; 131 message += "<td><p><a href=\\"/car?a=8\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">v</button></a></p> "; 132 message += "<td><p><a href=\\"/car?a=9\\"><button style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">\\\\</button></a></p> "; 133 message += "</table> "; 134 message += "</body></html>"; 135 server.send(200, "text/html", message); 136 } 137 138void tempSinyal() 139{ 140 if (SolSinyal==1) 141 digitalWrite(Led1_pin,!digitalRead(Led1_pin)); 142 143 if (SagSinyal==1) 144 digitalWrite(Led2_pin,!digitalRead(Led2_pin)); 145 146 if (ArkaLamba==1) 147 digitalWrite(Led4_pin,!digitalRead(Led4_pin)); 148 149} 150 151 152 153void handleNotFound() { 154 String message = "File Not Found\ 155\ 156"; 157 message += "URI: "; 158 message += server.uri(); 159 message += "\ 160Method: "; 161 message += (server.method() == HTTP_GET) ? "GET" : "POST"; 162 message += "\ 163Arguments: "; 164 message += server.args(); 165 message += "\ 166"; 167 for (uint8_t i = 0; i < server.args(); i++) { 168 message += " " + server.argName(i) + ": " + server.arg(i) + "\ 169"; 170 } 171 server.send(404, "text/plain", message); 172} 173 174 175void setup() { 176 177 pinMode(L298N_A_In1_pin,OUTPUT); 178 pinMode(L298N_A_In2_pin,OUTPUT); 179 pinMode(L298N_B_In3_pin,OUTPUT); 180 pinMode(L298N_B_In4_pin,OUTPUT); 181 182 digitalWrite(L298N_A_In1_pin,LOW); 183 digitalWrite(L298N_A_In2_pin,LOW); 184 digitalWrite(L298N_B_In3_pin,LOW); 185 digitalWrite(L298N_B_In4_pin,LOW); 186 187 pinMode(Led1_pin,OUTPUT); 188 pinMode(Led2_pin,OUTPUT); 189 pinMode(Led3_pin,OUTPUT); 190 pinMode(Led4_pin,OUTPUT); 191 192 digitalWrite(Led1_pin,LOW); 193 digitalWrite(Led2_pin,LOW); 194 digitalWrite(Led3_pin,LOW); 195 digitalWrite(Led4_pin,LOW); 196 197 Serial.begin(115200); 198 199 WiFi.mode(WIFI_STA); 200 WiFi.begin(ssid, password); 201 Serial.println(""); 202 while (WiFi.status() != WL_CONNECTED) { 203 delay(500); 204 Serial.print("."); 205 } 206 Serial.println(""); 207 Serial.print("Connected to "); 208 Serial.println(ssid); 209 Serial.print("IP address: "); 210 Serial.println(WiFi.localIP()); 211 212 server.on("/", handleRoot); 213 server.on("/car", handleCar); 214 215server.on("/inline", []() { 216 server.send(200, "text/plain", "this works as well"); 217 }); 218 219 server.onNotFound(handleNotFound); 220 221 server.begin(); 222 Serial.println("HTTP server started"); 223} 224 225void loop() { 226 server.handleClient(); 227}
untitled
arduino
1#include <ESP8266WiFi.h> 2#include <ESP8266WebServer.h> 3 4const 5 char* ssid = "Lavender"; 6const char* password = "5335921602"; 7 8ESP8266WebServer 9 server(80); 10 11const byte L298N_A_pin = D1; // GPI05 12const byte L298N_A_In1_pin 13 = D2; //GPI04 14const byte L298N_A_In2_pin = D3; //GPI0 15 16const byte L298N_B_In3_pin 17 = D4; // GPI02 18const byte L298N_B_In4_pin = D5; // GPIO14 19const byte L298N_B_pin 20 = D6; //GPI12 21 22const byte Led1_pin = D7; //GPIO13 // Sol Sinyal 23const 24 byte Led2_pin = D8; //GPIO15 // Sag Sinyal 25const byte Led3_pin = D9; //GPIO3 26 // On Far 27const byte Led4_pin = D10; //GPI01 // Arka Lamba 28const byte 29 Korna_pin = D0; //GPI016 //Korna 30byte SolSinyal = 0; 31byte SagSinyal = 0; 32byte 33 ArkaLamba = 0; 34 35 36 37void motorSpeed(int prmA, byte prmA1, byte prmA2, 38 int prmB, byte prmB1, byte prmB2) 39{ 40 analogWrite(L298N_A_pin,prmA); 41 analogWrite(L298N_B_pin,prmB); 42 43 44 digitalWrite(L298N_A_In1_pin,prmA1); 45 digitalWrite(L298N_A_In2_pin,prmA2); 46 47 digitalWrite(L298N_B_In3_pin,prmB1); 48 digitalWrite(L298N_B_In4_pin,prmB2); 49 50} 51 52void 53 handleRoot() { 54 server.send(200, "text/plain", "hello from esp8266!"); 55 56 } 57 58void handleCar() { 59 String message = ""; 60 int BtnValue = 0; 61 62 for (uint8_t i = 0; i < server.args(); i++) { 63 if (server.argName(i)=="a") 64 65 { 66 String s = server.arg(i); 67 BtnValue = s.toInt(); 68 } 69 70 Serial.println(server.argName(i) + ": " + server.arg(i) + "\ 71"); 72 } 73 74 75 switch (BtnValue) { 76 case 1: // sola donuş 77 motorSpeed(900,LOW,LOW,1023,HIGH,LOW); 78 79 SolSinyal = 1; 80 digitalWrite(Led1_pin,HIGH); 81 break; 82 83 case 2: // düz ileri 84 motorSpeed(1023,HIGH,LOW,1023,HIGH,LOW); 85 SolSinyal 86 = 0; 87 SagSinyal = 0; 88 digitalWrite(Led1_pin,LOW); 89 digitalWrite(Led2_pin,LOW); 90 91 break; 92 case 3:// saga donuş 93 motorSpeed(1023,HIGH,LOW,900,LOW,LOW); 94 95 SagSinyal = 1; 96 digitalWrite(Led2_pin,HIGH); 97 break; 98 99 case 4:// tam sola donuş 100 motorSpeed(900,LOW,HIGH,900,HIGH,LOW); 101 102 SolSinyal = 1; 103 digitalWrite(Led1_pin,HIGH); 104 break; 105 case 106 5: // stop 107 motorSpeed(0,LOW,LOW,0,LOW,LOW); 108 SolSinyal = 0; 109 SagSinyal 110 = 0; 111 digitalWrite(Led1_pin,LOW); 112 digitalWrite(Led2_pin,LOW); 113 break; 114 115 case 6:// 116 motorSpeed(900,HIGH,LOW,900,LOW,HIGH); 117 SagSinyal 118 = 1; 119 digitalWrite(Led2_pin,HIGH); 120 break; 121 case 7://sol geri 122 123 motorSpeed(900,LOW,LOW,1023,LOW,HIGH); 124 break; 125 case 8:// tam geri 126 127 motorSpeed(900,LOW,HIGH,900,LOW,HIGH); 128 break; 129 case 9:// 130 sag geri 131 motorSpeed(1023,LOW,HIGH,900,LOW,LOW); 132 default: 133 break; 134 135 } 136 if (BtnValue > 7) 137 { 138 ArkaLamba = 1; 139 SolSinyal = 1; 140 141 SagSinyal = 1; 142 digitalWrite(Led1_pin,HIGH); 143 digitalWrite(Led2_pin,HIGH); 144 145 digitalWrite(Led4_pin,HIGH); 146 } 147 else 148 { 149 ArkaLamba = 0; 150 151 digitalWrite(Led4_pin,LOW); 152 } 153 154 message += "<html> <head> <title>Gungor 155 yalcin</title><head>"; 156 message += "<body><h3>Wifi Robot Car NodeMCU Web 157 Server</h1>"; 158 message += "<table> "; 159 message += "<tr>"; 160 message 161 += "<td><p><a href=\\"/car?a=1\\"><button style=\\"width:100;height:100;font-size:100px;\\" 162 class=\\"button\\">\\\\</button></a></p> "; 163 message += "<td><p><a href=\\"/car?a=2\\"><button 164 style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">^</button></a></p> 165 "; 166 message += "<td><p><a href=\\"/car?a=3\\"><button style=\\"width:100;height:100;font-size:100px;\\" 167 class=\\"button\\">/</button></a></p> "; 168 message += "<tr>"; 169 message 170 += "<td><p><a href=\\"/car?a=4\\"><button style=\\"width:100;height:100;font-size:100px;\\" 171 class=\\"button\\"> < </button></a></p> "; 172 message += "<td><p><a href=\\"/car?a=5\\"><button 173 style=\\"width:100;height:100;font-size:40px;\\" class=\\"button\\">Stop</button></a></p> 174 "; 175 message += "<td><p><a href=\\"/car?a=6\\"><button style=\\"width:100;height:100;font-size:100px;\\" 176 class=\\"button\\"> > </button></a></p> "; 177 message += "<tr>"; 178 message 179 += "<td><p><a href=\\"/car?a=7\\"><button style=\\"width:100;height:100;font-size:100px;\\" 180 class=\\"button\\">/</button></a></p> "; 181 message += "<td><p><a href=\\"/car?a=8\\"><button 182 style=\\"width:100;height:100;font-size:100px;\\" class=\\"button\\">v</button></a></p> 183 "; 184 message += "<td><p><a href=\\"/car?a=9\\"><button style=\\"width:100;height:100;font-size:100px;\\" 185 class=\\"button\\">\\\\</button></a></p> "; 186 message += "</table> "; 187 188 message += "</body></html>"; 189 server.send(200, "text/html", message); 190 191 } 192 193void tempSinyal() 194{ 195 if (SolSinyal==1) 196 digitalWrite(Led1_pin,!digitalRead(Led1_pin)); 197 198 199 if (SagSinyal==1) 200 digitalWrite(Led2_pin,!digitalRead(Led2_pin)); 201 202 203 if (ArkaLamba==1) 204 digitalWrite(Led4_pin,!digitalRead(Led4_pin)); 205 206} 207 208 209 210void 211 handleNotFound() { 212 String message = "File Not Found\ 213\ 214"; 215 message 216 += "URI: "; 217 message += server.uri(); 218 message += "\ 219Method: "; 220 221 message += (server.method() == HTTP_GET) ? "GET" : "POST"; 222 message += 223 "\ 224Arguments: "; 225 message += server.args(); 226 message += "\ 227"; 228 229 for (uint8_t i = 0; i < server.args(); i++) { 230 message += " " + server.argName(i) 231 + ": " + server.arg(i) + "\ 232"; 233 } 234 server.send(404, "text/plain", 235 message); 236} 237 238 239void setup() { 240 241 pinMode(L298N_A_In1_pin,OUTPUT); 242 243 pinMode(L298N_A_In2_pin,OUTPUT); 244 pinMode(L298N_B_In3_pin,OUTPUT); 245 pinMode(L298N_B_In4_pin,OUTPUT); 246 247 248 digitalWrite(L298N_A_In1_pin,LOW); 249 digitalWrite(L298N_A_In2_pin,LOW); 250 digitalWrite(L298N_B_In3_pin,LOW); 251 252 digitalWrite(L298N_B_In4_pin,LOW); 253 254 pinMode(Led1_pin,OUTPUT); 255 pinMode(Led2_pin,OUTPUT); 256 257 pinMode(Led3_pin,OUTPUT); 258 pinMode(Led4_pin,OUTPUT); 259 260 digitalWrite(Led1_pin,LOW); 261 262 digitalWrite(Led2_pin,LOW); 263 digitalWrite(Led3_pin,LOW); 264 digitalWrite(Led4_pin,LOW); 265 266 267 Serial.begin(115200); 268 269 WiFi.mode(WIFI_STA); 270 WiFi.begin(ssid, 271 password); 272 Serial.println(""); 273 while (WiFi.status() != WL_CONNECTED) 274 { 275 delay(500); 276 Serial.print("."); 277 } 278 Serial.println(""); 279 280 Serial.print("Connected to "); 281 Serial.println(ssid); 282 Serial.print("IP 283 address: "); 284 Serial.println(WiFi.localIP()); 285 286 server.on("/", handleRoot); 287 288 server.on("/car", handleCar); 289 290server.on("/inline", []() { 291 server.send(200, 292 "text/plain", "this works as well"); 293 }); 294 295 server.onNotFound(handleNotFound); 296 297 298 server.begin(); 299 Serial.println("HTTP server started"); 300} 301 302void 303 loop() { 304 server.handleClient(); 305}
Github
Downloadable files
nodemcu_wifi_car_TuayHXzQBl.jpg
nodemcu_wifi_car_TuayHXzQBl.jpg
github
https://github.com/GungorYalcin/ArduinoDersleri/tree/master/gy_NodeMCU_Wifi_Robot_Car_Webservis
nodemcu_gpios_b8bZaMrnt6.png
nodemcu_gpios_b8bZaMrnt6.png
webservis_YAnvuKqExx.jpg
webservis_YAnvuKqExx.jpg
nodemcu_gpios_b8bZaMrnt6.png
nodemcu_gpios_b8bZaMrnt6.png
nodemcu_wifi_car_TuayHXzQBl.jpg
nodemcu_wifi_car_TuayHXzQBl.jpg
webservis_YAnvuKqExx.jpg
webservis_YAnvuKqExx.jpg
github
https://github.com/GungorYalcin/ArduinoDersleri/tree/master/gy_NodeMCU_Wifi_Robot_Car_Webservis
Comments
Only logged in users can leave comments
Anonymous user
2 years ago
I do not know how to access the controls on the web server part...please help what would the ip address be i can get to the part that says hello but I do not see where to go to get the buttons to control the car. Thanks
Anonymous user
2 years ago
the buttons dont show up on my page please help
Anonymous user
2 years ago
I figured out the button part but nothing moves they make a buzzing noise...do I not have enough power?
drivinggun
5 years ago
the buttons dont show up on my page please help
drivinggun
2 years ago
I figured out the button part but nothing moves they make a buzzing noise...do I not have enough power?
drivinggun
5 years ago
I do not know how to access the controls on the web server part...please help what would the ip address be i can get to the part that says hello but I do not see where to go to get the buttons to control the car. Thanks
Anonymous user
6 years ago
This is excellent! I am going to make an automated lawn mower using this as a prototype. Thank you for sharing your work.
Anonymous user
6 years ago
Useful idea. if there are more description, it would be more easy to understand:)
Anonymous user
2 years ago
Useful idea. if there are more description, it would be more easy to understand:)