Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 17366

Re: Trying to use PySerial to drive a serial lcd (parallax)?

$
0
0

Greetings

I was able to use PySerial to read and send strings. I just downloaded the pyserial 2.7 from this site https://pypi.python.org/pypi/pyserial , and install in my Galileo. Then I configured the gpio 4, 40 and 41 to use the pin 0 and 1 as a serial port by following the commands under GPIO configuration in Sergey’s blog http://www.malinov.com/Home/sergey-s-blog/intelgalileo-configuringtheserialportinlinux . Once the GPIOs are configured you are all set just go to python it is as simple as

import serial

ser = serial.Serial(“/dev/ttyS0”, 57600)                   #this is to use the pin 0 and 1 as a serial port

 

or


ser = serial.Serial(“/dev/ttyGS0”, 9600)                  #you can test this by reading this post and send data through the serial monitor in Arduino IDE

Then you can just follow this guide to learn how to use this library http://pyserial.sourceforge.net/shortintro.html .

If you want to configure the GPIO pins inside python you’ll need to use the os library

import os
os.system(“echo –n  0 > /sys/class/gpio/gpio40/value”)

This is just an example you can use all the commands in the configuration of Sergey’s blog like this os.system("command"), and remember if you want to use the pin 0 and 1 as a serial port, you need to put 0 in the value of gpio40 and gpio41 and don't forget the level shifter (gpio4) in case you need it. Let me know if this helped you.

Regards
JPMontero_Intel


Viewing all articles
Browse latest Browse all 17366

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>