[SOLVED!] Elegoo Smart Robot Car v4.0 Socket Programming Not Working

Hi, I'm having a problem with the Elegoo Smart Robot Car. Following the instructions in this video:
(https://www.youtube.com/watch?v=j7p44vxyvdM), I get no response from the car when I send data to it. I can send a simple command in the Spyder interface,

import socket
import json
import sys
import time
import re

# Yes, I know thatt I'm not using time or re.

ip = "192.168.4.1"
port = 100
print('Connect to {0}:{1}'.format(ip, port))
car = socket.socket()
try:
    car.connect((ip, port))
except:
    print('Error: ', sys.exc_info()[0])
    sys.exit()
print('Connected!')

print('Receive from {0}:{1}'.format(ip, port))

def recieve():
    try:
        data = car.recv(1024).decode()
    except:
        print('Error: ', sys.exc_info()[0])
        sys.exit()
    print('Received: ', data)
    

msg = { "H": 1 , "N": 5 , "D1": 1 , "D2" : 30}

jsonmsg = json.dumps(msg)

off = [0.007,  0.022,  0.091,  0.012, -0.011, -0.05]
try:
    # Send the car a message
    car.send(jsonmsg.encode())
    print('Sent: ' + jsonmsg)
except:
    print('Error: ', sys.exc_info()[0])
    sys.exit()

recieve()

And I get nothing from the car. What's supposed to happen is the car should rotate a servo motor, it does not rotate the servo motor. It's supposed to send back feedback, does not send feedback. No error messages, nothing. Please help!

If useful, I'm running a Windows 11 Pro.

Tell me if you need more code, the robot's source code, etc.

Hey, could anybody please respond? I kinda really want to start programming this thing.

Hi. Why the rush?

What part of the kit are you testing?

There really isn't a rush, I'm just excited :smile:

What do you mean what part?

Those kits can be built and programmed from start to finish with no problems, but when there is a problem, start with testing each device, then add and test, repeat...

What parts work?

The ESP32 works just fine, the original code for the main circuit board compiles and uploads no probs, the only thing that doesn't is using sockets.

The problem could be (1) material, (2) connections, (3) code, (4) power...

How is the ESP32 used in the project?
Can you show that the ESP32 works fine?
How do you determine "sockets" is the only problem?

Provide (upload) a document here so we can see what you are seeing.

(Those videos do a lot of pre-video work and compress a day of work and re-working into 15 minutes.)

Sorry, can't provide pictures now. Currently out at lunch. Get back to you in 30

In that video, verify your system is configured starting at 3:20... pause at each point made... write it down... unpause... repeat.

Will do! Thanks

About minute 7 of the video in Post #1, things get out-of-hand, by re-writing library files, and more in-depth figuring out... Maybe write to Elegoo technical support.

I will help with getting basic functions working.

I run the Python file the first time and get this output (the servo does not rotate, however):

I run it again and get this:

The code is stuck in an infinite while loop, looking for information that does not exist, since there cannot be an response for an invalid/unexisting send.

I triple checked the video, his settings, and stuff. I'll rewatch the video, but for now, I can't find the issue

Also, pt.2 of the video explains the code that I've written down: https://www.youtube.com/watch?v=LyReKO6Pg0g

More information: In Arduino IDE, I can use the Serial monitor to send commands via usb. For example: {"H":1, "N": 5, "D1": 1, "D2": 30}. H is the command identifier, so its identifier is 1. N is the command type, and five corresponds to rotating the servo. D1 is the first parameter, the servo type in this case. My servo type is one. D2 parameter 2, the angle to rotate the servo at, in this case, which is 30. Sending this code rotates the servo 30 degrees.

But, running the same command via sockets via Spyder python console doesn't get any reply or response.

The input in the serial monitor, and the response from the robot's code:

How do you verify the servo works?

Cuz it turns when I use arduino IDE via usb but not over sockets

Note: I'm really grateful for you to help me with this. I'm sorry if I get on your nerves or anything, but last post I made went completely unreplied to and I had to figure it out on my own

Without seeing the receiver code, kind of hard to tell..
Wonder though, could just be waiting for an ending newline..
Your serial terminal adds one for you on each string you type and send..
Try to add a newline to your python, sorry, can't help with that..

good luck.. ~q

Okay. Servo is good.

The part you indicate is not working... was it supposed to work "out of the box?" without reconfiguring?

Ill try, thanks

I'm not sure.