So i need to do my project to school i assembled the car and tested it out with a simple code and it worked like nothing , but i cant imagine how the full code would look like , could someone help with it? I am adding a pic of it w - Album on Imgur
No picture
i added it now
The picture is at the top added now.
and the code is there:
#include <AFMotor.h>
AF_DCMotor firstmotor(1);
AF_DCMotor secondmotor(2);
AF_DCMotor thirdmotor(3);
AF_DCMotor fourthmotor(4);
#include <ESP8266WiFi.h>
WiFiClient client;
WiFiServer server(80);
const char* ssid = "YOUR SSID";
const char* password = "YOUR PASSWORD";
String data ="";
int firstmotor = 1; /* GPIO2(D4) -> IN3 */
void setup()
{
pinMode(firstmotor, OUTPUT);
server.begin();
}
void loop()
{
client = server.available();
if (!client) return;
data = checkClient ();
if (data == "forward") MotorForward();
}
void FORWARD()
{
firstmotor.run(FORWARD);
secondmotor.run(FORWARD);
thirdmotor.run(FORWARD);
fourthmotor.run(FORWARD);
}
}
String checkClient (void)
{
while(!client.available()) delay(1);
String request = client.readStringUntil('\r');
request.remove(0, 5);
request.remove(request.length()-9,9);
return request;
}
The full code is going to depend on what you want the car to do. You have said nothing about that.
Steve
You should read the "How to use this forum - please read." at the top of the discussion list which should show you how to post code and pictures to the forum. That being said, how do you want the car to operate?
zoomkat:
You should read the "How to use this forum - please read." at the top of the discussion list
I already gave the OP a link to that and asked them to read it. They must have chosen to ignore it...
Unplug the USB cable from the computer and plug it into one of the below battery packs attached to the car and away it goes.