Answer the question
In order to leave comments, you need to log in
How to work with UART on Raspberry?
Good afternoon.
I will make a reservation right away, I just bought Malinka and still vaguely imagine how to work with it.
Global task:
I need a command from the device (The device communicates with me via UART with its own specific protocol) Read data from the USB flash drive and save it. Simple database in text format.
Further, on the following requests, issue the necessary information from the downloaded database.
When installing the Raspbian OS, I installed not a console, but a visual environment.
Reading various articles about Raspberry, for some reason everyone works with her through the console.
Why?
It is not clear to me where to write a data processing program for UART. Do I need to install separate software? Something like Kylix (Delphi for Linux). But then you need special libraries to work with the Malinka ports. But I didn't find them.
I found on the Internet how to "activate" Usart on raspberries. How to send a string through the console via Usart to the device, and according to the promises from the article in the same console, if available, the accepted answer will be displayed.
Something was written about Python. But as I understand it, this is generally a line-by-line "programming" environment.
And where can I write a full-fledged data processing code?
Answer the question
In order to leave comments, you need to log in
See the manual here www.elinux.org/Serial_port_programming
In short: you need to install the PySerial library (apt-get install python-serial) and configure /etc/inittab and /boot/cmdline.txt according to www.elinux.org/RPi_Serial_Connection#Preventing_Li. ..
import serial
port = serial.Serial("/dev/ttyAMA0", baudrate=115200, timeout=3.0)
while True:
port.write("\r\nSay something:")
rcv = port.read(10)
port.write("\r\nYou sent:" + repr(rcv))
python test_sertial.py
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question