EDIT: Dear god - I'm not sure if I should be happy or mad. I didn't have a feaking newline ("\n") character at the end of my string so readline() was just waiting and waiting and waiting...
Problem solved...
I've spent the last week reading everything I can find - and I'm about to lose my mind. I have a pico set up with a few temperature sensors. Everything is working correctly on the pico (as far as I can tell). Here is some test code I'm working with on the pico:
import os import utime from machine import ADC, UART, Pin led = Pin(25, Pin.OUT) def temperature(): return 27 - (((ADC(4).read_u16() / 65535)*3.3) - 0.706)/0.001721 uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1), bits=8, parity=None, stop=1) while True: print(temperature()) print(uart) uart.write(f"{temperature()}") #need a new line character here, so uart.write(f"{temperature()}\n") fixes the issue. utime.sleep(1) led.toggle() # so I know the pico is powered/working On the Pi Zero, I can read serial from the pico if I connect both via a micro usb micro usb connection. Such as:
import serial while True: ser = serial.Serial('/dev/ttyACM0', 9600) print(ser.readline().decode("utf-8".rstrip())) However, I cannot figure out how to read uart gpio data on the Pi Zero. I've tried a whole bunch of different methods, but the most progress I've made is with the following code on the pi zero (by progress, I just mean I don't get any errors):
import serial while True: ser = serial.Serial('/dev/ttyAMA0', 9600) print(ser.readline().decode("utf-8".rstrip())) But, I don't get any data back. When I run the script, it just sits there forever like it's listening, but nothing happens.
I have the pi zero and pico wired as follows:
Pi zero powered by USB
Pi Zero pin 1 (3v3) Pico pin 39 (VSYS) Pi Zero pin 6 (GND) Pico pin 3 (GND) Pi Zero pin 8 (UART Tx) Pico pin 2 (UART Rx) Pi Zero Pin 10 (UART Rx) Pico pin 1 (UART Tx) Pi Zero Pin 14 (GND) Pico pin 3 (GND) I've read just about every blog on the internet, I'm not sure what else to do at this point. Any ideas? What am I doing wrong?
submitted by /u/pconwell
[link] [comments]
More...
About to lose my mind - how do I read uart data FROM pico TO a pi zero through GPIO pins?
The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.
Post Reply
1 post
• Page 1 of 1
- /RaspberryPi
- Corporate
- Posts: 2449
- Joined: Wed Jun 05, 2019 1:29 am
Post Reply
1 post
• Page 1 of 1
Return to “Raspberry Pi Forum”
Jump to
- From Retro to Current
- ↳ Classified Ads
- ↳ Community
- ↳ Marketplace
- ↳ Jobs
- ↳ Dating
- ↳ Housing
- Nintendo Forums
- ↳ SNES Classic Edition Forum
- ↳ Switch Forum
- ↳ NES Classic Edition Forum
- ↳ Wii U Forum
- ↳ 3DS Forum
- ↳ Wii Forum
- ↳ DS Forum
- ↳ Gamecube Forum
- ↳ Game Boy Advance Forum
- ↳ Game Boy Color Forum
- ↳ Nintendo 64 Forum
- ↳ Super Nintendo Forum
- ↳ Game Boy Forum
- ↳ Nintendo Entertainment System Forum
- ↳ Game & Watch Forum
- SONY Forums
- ↳ PlayStation 5 Forum
- ↳ PlayStation Classic Forum
- ↳ PlayStation 4 Forum
- ↳ PlayStation Vita Forum
- ↳ PlayStation 3 Forum
- ↳ PlayStation Portable Forum
- ↳ PlayStation 2 Forum
- ↳ PlayStation 1 Forum
- Microsoft Forums
- ↳ Xbox Series Forum
- ↳ Xbox One Forum
- ↳ Xbox 360 Forum
- ↳ Xbox Forum
- SEGA Forums
- ↳ Genesis Mini Forum
- ↳ Dreamcast Forums
- ↳ Sega Saturn Forum
- ↳ Genesis Forum
- ↳ Master System Forum
- Other System Forums
- ↳ General Discussion
- ↳ Other Console Forum
- ↳ Arcade Cabinet Forum
- ↳ Windows, Mac, & Linux Forum
- ↳ Atomiswave Forums
- ↳ WWW.ATOMISWAVE.NET
- ↳ General Discussion
- ↳ Tech Support
- ↳ System Setups
- ↳ Modified Moderboards
- ↳ Home Consoles & Systems
- ↳ Arcade & Candy Cabinets
- ↳ Marketplace
- ↳ Video Game Marketplace
- ↳ Game Discussion
- ↳ Video Game Catalogs
- ↳ FAQs, Reviews, & Guides
- ↳ Assorted Discussion
- ↳ Custom Ideas
- ↳ Open Discussion
- ↳ SNK Neo Geo Forums
- ↳ General Discussion
- ↳ Buying & Selling
- ↳ Tech Support
- ↳ Systems
- ↳ Neo Geo Arcade Stick Pro Forum
- ↳ Neo Geo Mini Forum
- ↳ Neo Geo X Forum
- ↳ Neo Geo CD Forum
- ↳ Neo Geo MVS Forum
- ↳ TurboGrafx-16 Forums
- ↳ General Discussion
- ↳ Marketplace
- ↳ Magazine Scans
- ↳ Games
- ↳ TurboChip/HuCard Forum
- ↳ CD-ROM²/Super CD-ROM²/Arcade CD-ROM² Forum
- ↳ Systems
- ↳ TurboGrafx-16 Mini Forum
- ↳ TurboDuo Forum
- ↳ TurboExpress/PC Engine GT/LT Forum
- ↳ SuperGrafx Forum
- ↳ TurboGrafx-CD/PC Engine CD Forum
- ↳ TurboGrafx-16/PC Engine Core Forum
- ↳ Raspberry Pi Forum
- ↳ Atari Forum