Two snakes, one Python?

Go To Last Post
31 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My thread title is based on this post by Johan:

 

If Python can do COM ports, then go with that. Otherwise perhapss C#/.NET (assuming we're talking Windows here).

And Awneils reply:

JohanEkdahl wrote:

If Python can do COM ports

 

Yes, it can: http://pythonhosted.org/pyserial/

 

laugh

From this thread:

https://www.avrfreaks.net/forum/s...

 

I am learning Python by using my Rpi's and I am getting ready to explore the COM port which in the example in the book, I am going to communicate with an AVR.

 

When I started learning C, Cliff, and many other wise Guru's all recommended I NOT learn C on a Micorcontroller, but on a PC first using Pelles as a starting point.  I ended up doing both in some respects, but I did see that C on a PC is somewhat different than C on a micorcontroller.

 

Does the same hold true for Python as well?  WHat works on an Rpi, or Bone, or CHiP may not work on a PC and vice versa?

 

So far my "Teach myself Python" by reading a lot of books and actually doing the examples has been rather pleasurable, with only two parts that I am having some trouble with, but I hope to sort out soon.

 

I would like to soon try creating a simple GUI that I can run on Windoze that would communicate to either a real RS232 port, or USB COM port, but first I would like to know if there is a big difference between Python on a PC, and Python on a Pi, Bone, or CHip.  Or if I can run python on a PC to begin with.

 

JIm

 

EDIT:

Looks like Pythin for the PC is available:

https://www.python.org/downloads/

 

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Thu. Aug 31, 2017 - 01:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Careful that it doesn't get you in a stranglehold!

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

C'mon John, stop................frown

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's probably little difference between the Raspi and a PC in terms of the experience. The raspi running linux is really just a lower performance PC. So use whichever one is more convenient. If you had said something like learning python on a Microbit running micropython vs a PC, then I'd say PC.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Russell.

 

I said I was planning on eventually setting up a project where the Rpi communicated to the PC and I was going to write a Python app for the PC, and I am/was wondering if the GUI examples in my books for the Rpi will work with a little modification on a PC.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It is my understanding they should work without any change - note i'm far from being half knowledgeable about python.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
There's probably little difference between the Raspi and a PC in terms of the experience. The raspi running linux is really just a lower performance PC

Agreed.

 

However, the RPi performance is quite significantly lower than a typical PC, so you might find that a little frustrating - depending on how (im)patient you are

 

When you say, "PC" - is that running Windoze or linux?

If the PC is Windoze, then you will, of course, have all the normal Win/Lin differences - COM ports versus /dev/tty, etc.

 

For GUI work, you will probably be using some "framework" which hides underlying OS anyhow - so the portability is more to do with the framework than Python itself.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Two snakes, one Python?

I thought this was going to be about Python 3 vs Python 2 ...

 

https://wiki.python.org/moin/Python2orPython3

 

https://www.raspberrypi.org/documentation/usage/python/more.md

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Does the same hold true for Python as well? WHat works on an Rpi, or Bone, or CHiP may not work on a PC and vice versa?
Quite the opposite. I actually developed the majority of an extensive Python application that was ultimately to be used in Windows using a Linux development machine. It's even the case that Pycharm from JetBrains is available to run on both Windows and Linux so whichever OS I happen to be using I can use a virtually identical IDE too !

 

In my case both Windows and Linux were running on AMD64 processor but the Linux might just as easily have been a Cortex-A or something (ie something like an RPi).

 

This is the very reason a lot of people (me included) love Python because it lets you write programs that (alomst) look and run identically on different platforms. Is far easier to write multi-platform Python than it is to do that with C/C++. In part this is because Python comes as standard with Tkinter/Tcl for authoring GUI parts.

 

For an example see: https://www.avrfreaks.net/comment... which shows the very same code running in both Linux and Windows - they look/perform in a very similar way:

 

 

I assume (though I've never used it myself) that you are going to find that Pyserial works in an equally multi-platform way. I guess you still face the difference between COM7 versus /dev/ttyUSB3 or whatever.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is still a site dedicated to Atmel AVR.

Just sayin...

Bob. Engineer and trainee Rocket Scientist.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob,

 

Surely Jim's goal here is to ultimately make a com link to an AVR? I think a number of AVR users could be interested in knowing how he gets on using PySerial to do that. (well at least one anyway ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
I assume (though I've never used it myself) that you are going to find that Pyserial works in an equally multi-platform way.

Yes, it does - I have done it myself.

 

I guess you still face the difference between COM7 versus /dev/ttyUSB3 or whatever.

Correct.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

donotdespisethesnake wrote:

This is still a site dedicated to Atmel AVR.

Just sayin...

 

It is, and this is the General programming section.  There have been threads in here for competitors programming and we still answered those questions.

 

clawson wrote:
Surely Jim's goal here is to ultimately make a com link to an AVR?

Yes, among other things.

 

I find Bob's comment rather funny.....I am asking a question about a programming language named after a snake, and the only member complaining 's username tells the world not to despise a snake.

 

All good.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
I find Bob's comment rather funny.....

He is probably obsessed by snakes.

Maybe his parents were snakes?

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK,

I'm sorry,

From your reaction I assume my remark has some unintended  bad taste ?

(Im not native Englisch speaker, missed something I think).

You may delete it if you wish.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Surely Jim's goal here is to ultimately make a com link to an AVR? I think a number of AVR users could be interested in knowing how he gets on using PySerial to do that. (well at least one anyway ;-)
In the case of LInux, virtual serial ports just work.

The only trick is discovering which serial port to open.

In the case of XP, my recollection is that I needed a .inf file for each VID, PID pair.

Don't know about later versions.

One still needs to discover which serial port to open.

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

skeeve wrote:
In the case of XP, my recollection is that I needed a .inf file for each VID, PID pair.

Don't know about later versions.

Improved for Windows 10 :

Microsoft logo

Microsoft

Developer

What is new with Serial in Windows 10

July 29, 2015

USB Blog

https://blogs.msdn.microsoft.com/usbcoreblog/2015/07/29/what-is-new-with-serial-in-windows-10/

...

 

1.   Improved Serial over USB driver support in Windows 10

Earlier versions of Windows contained a driver for USB connected serial devices: usbser.sys. However the driver did not include a compatible ID match in an INF. The driver had to be included using modem INFs which was not standard.

In Windows 10, we added inbox support for USB CDC Abstract Control Model (ACM) compliant hardware. Usbser.sys is now installed as a compatible ID match for USB CDC compliant hardware, without requiring a 3rd party driver or inclusion via modem INFs.

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

skeeve wrote:
In the case of LInux, virtual serial ports just work.

Same with Widows 7.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
I find Bob's comment rather funny.....I am asking a question about a programming language named after a snake.
It's name after Monty Python: good movies, not so much the TV series.

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Learn something new everyday......

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Surely Jim's goal here is to ultimately make a com link to an AVR? I think a number of AVR users could be interested in knowing how he gets on using PySerial to do that. (well at least one anyway ;-)

 

I want to know.

 

I actually want a passel of little Python serial port programs, one for each AVR project, that drastically simplify the AVR end of sending (and receiving) a complex sequence of commands and data.  Learning Python is on the list...  (*sigh*.  Book recommendations are invited.  PC OS will probably be Win7.  Serial ports will be on USB<->RS232 adapters).

 

S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Scroungre wrote:
I actually want a passel of ... 

A what?

 

As noted, PySerial is what you need:

http://pyserial.readthedocs.io/en/latest/pyserial.html

 

Plus Python itself:

python™

https://www.python.org/

 

Beginner's Guide:

 

https://www.python.org/about/gettingstarted/

 

If you can find a recording of this webinar, I can strongly recommend it:

 

https://www.doulos.com/content/events/Python_One_Hour.php

 

(or sign up for their email alerts - I think they repeat it from time-to-time)

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Sat. Sep 2, 2017 - 08:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 2

awneil wrote:
Scroungre wrote: I actually want a passel of ... 

 

A what?

 

I, too, was puzzled by "passel". So I took action. Lo and behold: https://www.merriam-webster.com/...

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The inspiration did coruscate with that one.....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, yeah.. I'll just keep a browser tab open at Merriam-Webster then..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Learning Python

Martin Lutz

O'Reilly

Moderation in all things. -- ancient proverb

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Surely Jim's goal here is to ultimately make a com link to an AVR?

Thats somewhat a no brainer as there is an example in one of my books connecting an Rpi to an Arduino mega.  What I am at the moment trying to figure out is how the Rpi can handle comms in an interrupt scheme.  It seems with GPIO you simply invoke the Rpi.GPIO as GPIO thingie(I have no idea what to actually call "Rpi.GPIO as GPIO") and then enable an 'event' and set a debounce time and then put the code that is supposed to run in the event of an event (no pun intended).  This then leads me to wonder how one structures a Python application as in C you have MAIN, and then you have functions....either calls, or ISR's.  In Python, from the examples and tutorials this does not appear to be the case.  More reading and experimenting is in order.

 

The PySerial I am going to have to read more about.

 

@Cliff

I forgot about that little GUI you created until I saw how to create one in Python on the Rp, and then sure enough you post the same thing! 

 

My next foray into Comms on the Rpi is RS485.  On the AVR its a no brainer again, but a friend had mentioned that he could never get it to work on the Rpi, or the BeagleBone.  When I connected my Logic analyser to the lines I noticed a 60 millisecond delay from when the last byte left, and the RX/TX line flipped so replies were always lost.  Of course his application is huge encompassing a lot of other things going on, so I will be interested in seeing what happens with my little test.

 

So far I have the LED lighting up, and doing a blinky.  Done some basic I/O, and some simple comms.  Next would be to connect a 16x2 LCD and see if I can get that to work, but I/O is at a premium on this thing.

 

One thing I am wondering is where I can find a list of all the import thingies as I call them.  Rpi.gpio is one for example, random is another.  In one of my books they are called libraries.  Going to have to search around to see if there is a list, the has to be one somewhere.

 

One of the other things I have noticed about Python is how in many instances it is similar to C.  THere are While, and For loops, Functions, and variables.  ALthough I am curious how variables are handles in Python as opposed to C...ie, are there Volatile, Global, and local?  MORE READING!

 

The books I purchased:

"Programming the Raspberry Pi....Getting started with Python"

 

"Raspberry Pi for Dummies"

 

"Raspberry Pi Electronics Projects

for the

Evil Genius"

 

The first one is very good and explains things rather clearly and is geared for the beginner.  THe second is a beginner to amateur level that some with better knowledge might find interesting as well.  The third is a book of projects with not much explanation about whats going on...possibly that information is in the repositories they point to on occasion.  Might try and return that one.

 

Well thats it for the moment.  HAve to get some things done around the house today so not much time to play.  I am going to be curious to see if I can migrate some of these programs from the Rpi to a BeagleBone, to a CHiP.

 

Like Johan says....The critical shortage her is not stuff, but time

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:
Thats somewhat a no brainer as there is an example in one of my books connecting an Rpi to an Arduino mega. What I am at the moment trying to figure out is how the Rpi can handle comms in an interrupt scheme. It seems with GPIO you simply invoke the Rpi.GPIO as GPIO thingie(I have no idea what to actually call "Rpi.GPIO as GPIO") and then enable an 'event' and set a debounce time and then put the code that is supposed to run in the event of an event (no pun intended). This then leads me to wonder how one structures a Python application as in C you have MAIN, and then you have functions....either calls, or ISR's. In Python, from the examples and tutorials this does not appear to be the case. More reading and experimenting is in order.
This is Linux - all the "interrupt" stuff will be done in the kernel device driver for the UART. At the app level the stuff will already be buffered so a Linux users does not need to concern themselves how the characters actually arrive/depart. Just that it's all handled "behind the scenes"
jgmdesign wrote:
When I connected my Logic analyser to the lines I noticed a 60 millisecond delay from when the last byte left, and the RX/TX line flipped so replies were always lost.
And that is the "downside" of Linux. It is not a "real time operating system". It is just an "operating system". You can't easily get guarantees about interrupt latency and stuff like that.

 

There are modifications that can be applied to Linux to make it more "real time" but if you really need to worry about microseconds rather than milliseconds yoy may well find yourself having to develop within "kernel" space.

jgmdesign wrote:
One thing I am wondering is where I can find a list of all the import thingies as I call them.
That's just general Python programming :

 

https://pypi.python.org/pypi

 

There are a LOT to choose from - most are high level and cross platform. Just a few are hardware specfic. If you track down rpi.gpio you get to:

 

https://pypi.python.org/pypi/RPi...

 

From there you can get to:

 

https://sourceforge.net/p/raspbe...

 

and from there to:

 

https://sourceforge.net/p/raspbe...

 

In the "source" you will find things such as:

 

https://sourceforge.net/p/raspbe...

 

but even here you won't find the stuff that interacts with the IO pins because that is in the kernel not the application space where Python live. The Python support code is simply opening a kernel device called either /dev/gpiomem or /dev/mem and then using a special Linux technique called mmap() to make it appear as addressable memory.

 

So although it "looks" as if something like:

 

 

is making direct memory rights to the location of the IO registers - this is a virtual process going through something setup by the device driver.

 

On the whole the reason you use Python on something like an Rpi is to "hide" all this from you. You just use it at the Python level as:

GPIO.output(channel, state)

and don't concern yourself about the Python wrapping around the C or the mmap() link to the /dev/gpiomem or whatever.

 

It's a different "mindset" when it comes to programming in Linux as most stuff is going to be at a very abstracted level compared to the nitty-gritty nuts and bolts of the hardware.

 

In fact Arduino is very good preparation for thinking in the "Linux way" because you almost never worry about the RXIE bit in the UCSRB reigster or whatever in that but only Serial.begin(9600) and everything else is "under the hood". Linux+Python is going to be very like this too. So, like Arduino, it's just "something different" to learn. The result is the same - the way you achieve it is not.

 

As I say Linux does not lend itself to "real time". It almost does not exist anyway and any hope you have of doing it is only down "inside" the kernel (at the same kind of level as the /dev/gpiomem we just saw).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

CLiff,

I am not looking to get into the low level nits and bits, I was looking for a list of the available 'libraries' as was said in one book, which it appears you have provided.  Thank You.

 

Ok, back to chores and I will look at all these links later today.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Something happened to my post in there.  I wonder what it was.  S.

 

Edit - It got split into a new thread.  S.

Last Edited: Mon. Sep 4, 2017 - 03:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just having a list of the import packages probably is not the way to go about programming Python. There's really good ones and there's real dross and it's almost impossible to tell one from the other just by looking at the "pypi" list. Better is to decided what it is you want to do in python (lets say "decode a jpeg") and then just google "python decode jpeg". If I do that I hit:

 

https://stackoverflow.com/questi...

 

so it looks like the "cleverness" comes from "PIL". Just to be sure I'd then google "pil image library python". A bit of to-ing and fro-ing then gets me to:

 

http://effbot.org/imagingbook/in...

 

So, yes, the Image class in the Python Image Library (PIL) looks like the kind of thing I probably want to use.

 

If I'd taken the other approach and just searched the Pypi package list for "jpeg" then I get 100+ results:

 

https://pypi.python.org/pypi?%3A...

 

but while some of those are wrapping around "pil" it's not even listed there (just "pil-lite").

 

So search by googling what it is you want to achieve and work back from there (usually stack overflow) to find the key "import"(s) that are involved.