Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8597

Beginners • Re: Python Programming on Windows -> Raspberry Pi, and Best RPI for Project?

$
0
0
Yes, you're on the right track! Python code is mostly cross-platform, and if you avoid OS-specific features, it should transfer over to your Raspberry Pi (RPI) smoothly. That said, here are a few things to watch out for when moving from Windows to RPI (Linux):
🔌 RS485 Cable
Device Path: On Windows, your RS485 cable might be COM3, etc., but on the RPI, it'll show up as something like /dev/ttyUSB0.
→ Make sure your Python code lets you set or detect the serial port dynamically.
🐍 Python Environment
Same Libraries: Ensure all libraries you use on Windows are also available on the Pi (pyserial, pymodbus, sqlite3 or MySQL, etc.).
Use a requirements.txt file to track dependencies.
🗃️ SQL Database
SQLite works well and is lightweight — great for Pi.
If you use MySQL/PostgreSQL, make sure it's installed and running on the Pi.
📊 Graphing & Web Display
For local web dashboards, lightweight frameworks like Flask or Dash are Pi-friendly.
Just ensure any paths (e.g., to static files) are relative, not hardcoded.
🔁 Polling
It should work identically. Just be aware of CPU usage on Pi — use sleep intervals or async where needed.

Statistics: Posted by fatirsahi — Sun Jun 22, 2025 11:12 am



Viewing all articles
Browse latest Browse all 8597

Trending Articles