• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

From ESP32 MicroPython Course

Q&A Forum › Category: ESP32 › From ESP32 MicroPython Course
0 Vote Up Vote Down
Keith asked 4 years ago

Refer: MicroPython Programming with ESP32 and ESP8266 V1_2. Page 169
I’m always receiving a -1 when my program executes request.find(‘/?led=on’) or ‘/?led=off’ meaning led_on or led_off are never == 6. I verified this with a print statement to see exactly what was being returned. It always seems to be -1.
When I connect to my board, the shell shows me the beginning of the content message to be…….”Content = b’GET /?led%20=%20on….” This does not look like I will ever get a match since it looks like the content contains %20 and will never match the /?led=on. 
Any help is greatly appreciated. Thanks, Keith

Question Tags: I'm always receiving a -1 when my program executes request.find('/?led=on') or '/?led=off'
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi.
Did you change anything on the code?
It seems like you have two extra spaces in your code. %20 means a space.
Check those spaces in your code.
Let me know if that solves the issue.
Regards,
Sara

0 Vote Up Vote Down
Keith answered 4 years ago

Hi Sara – It seems the code on git is different than the code in the ebook. When I loaded the code from git, it all works fine. When I loaded the code from the book it world not work. So going forward, I will load code from git. Thanks for your help. Regards……

0 Vote Up Vote Down
Sara Santos Staff answered 4 years ago

Hi again.
I always recommend using the code on github.
Copying the code from the eBook may mess up the formatting.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.