Go Down

Topic: Help to convert a arduino libarary to python (Read 1 time) previous topic - next topic


I purchased some  LCD 7 segment displays.  The vendor was able to give me some lib's but they were for the arduino, I am wondering if there was a kind soul that would mentor me though the process of converting the libs to python.




I am wondering if there was a kind soul that would mentor me though the process of converting the libs to python.

Are you running python on your Arduino? I'd be amazed if you were.


For hardware intensive stuff like this, it is generally better just to write your own. It is difficult for us to help you since all the action takes place where you make the hardware calls to control the segments. And we have no idea how to do that on your python machine.


What is this for, Raspberry Pi?  There are C to Python converters such as http://www.catb.org/esr/ctopy/.  But you have to understand that these convert C to Python, not a bunch of non-standard Arduino library calls in C to functionally equivalent library calls in whatever Raspberry Pi's extensions to Python are.  It can't do that.  It doesn't try to handle the architectural differences between the Arduino and the Raspberry Pi because it doesn't even know what they underlying platforms are.
I will never ask you to do anything that I wouldn't do myself.


It may vary depending on your device, but I guess that these libraries send messages over a bus to the device, using a certain protocol. Sometimes the protocol is just software, implemented by reading and writing over a serial connection using OS calls, but sometimes hardware-related signals are involved (as when you need drivers to communicate with a device).
Reading the libraries' code should tell you something, probably a lot, about the protocol used. Then you may find a python implementation for that protocol and start coding without bothering about the Arduino stuff. Porting code from Arduino-C to Python seems like a bad idea because some features may depend on the hardware.


I have been hacking my way through the code. I found another simple lib for the lcd still for the arduino but stripped down so I am able to hack my way through.  Should be interesting to see how it works when I run it.



Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131