0

Good afternoon everyone, For a school project I will make a RC car using a c8051 microcontroller and to send the uart data to it I'm using a ESP32 so that I can display a webpage so that the user choose the direction of the car. I've spent a lot of time on micropython doc's page and tutorial for TCP sockets and I see in every one of them that to check if the webpage was requested they use something like:

If(request==6):

And I can't figure out why 6, what that represents??

I appreciate any help given.

1
  • I don't have a clear answer to your question, but since it made me very curious i've looked it up (and you should have too). Anyway in this link link search for '== 6' and look for the answer given down below. I think it's clear enough.
    – George Bou
    Commented Apr 15, 2019 at 20:48

1 Answer 1

0

The answer found in the comment section of the link given

"In the while loop, after receiving a request, we need to check if the request contains the ‘/?led=on’ or ‘/?led=on’ expressions. For that, we can apply the find() method on the request variable. the find() method returns the lowest index of the substring we are looking for.

Because the substrings we are looking for are always on index 6, we can add an if statement to detect the content of the request. If the led_on variable is equal to 6, we know we’ve received a request on the /?led=on URL and we turn the LED on. If the led_off variable is equal to 6, we’ve received a request on the /?led=off URL and we turn the LED off."

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.