• 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

Problems running the Micropython code for the Neo-6M module on ESP32

Q&A Forum › Category: ESP32 › Problems running the Micropython code for the Neo-6M module on ESP32
0 Vote Up Vote Down
Ernest Musgrave asked 8 months ago

import machine
from time import sleep
# Define the UART pins and create a UART object
gps_serial = machine.UART(2, baudrate=9600, tx=17, rx=16)
while True:
if gps_serial.any():
line = gps_serial.readline() # Read a complete line from the UART
if line:
line = line.decode(‘utf-8’)
print(line.strip())
sleep(0.5)
 
I get:

Traceback (most recent call last):
File “<stdin>”, line 11, in <module>
UnicodeError:
 

Question Tags: NEO-6M
1 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 8 months ago

Hi.
Please double-check your RX-TX connection.
Double-check that you’re using the code with the right indentation.
 
Try commenting these lines:

line = line.decode(‘utf-8’)
print(line.strip())

and simply print the line content 

print(line)

 
And see what you get.
 
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

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 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.