Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #197890 > unrolled thread

Re: Arduino and Python or gcc compiler?

Started bycyaiplexys <cyaiplexys@sitesplace.net>
First post2018-07-22 16:40 +0200
Last post2018-07-22 22:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 16:40 +0200
    Re: Arduino and Python or gcc compiler? Erik Christiansen <dvalin@internode.on.net> - 2018-07-22 17:20 +0200
      Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 17:40 +0200
        Re: Arduino and Python or gcc compiler? Joe <joe@jretrading.com> - 2018-07-22 20:30 +0200
          Re: Arduino and Python or gcc compiler? cyaiplexys <cyaiplexys@sitesplace.net> - 2018-07-22 22:50 +0200

#197890 — Re: Arduino and Python or gcc compiler?

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 16:40 +0200
SubjectRe: Arduino and Python or gcc compiler?
Message-ID<wenGG-2y6-13@gated-at.bofh.it>
On 07/22/2018 03:26 AM, Joe wrote:

Joe, please forgive me that I forgot to click "Reply to list". I have NO 
valid excuse why I keep doing stupid things like that. :(

> On Sat, 21 Jul 2018 18:15:12 -0400
> cyaiplexys <cyaiplexys@sitesplace.net> wrote:
> 
>> I am getting the Elegoo Super Starter Kit (Arduino Uno R3) to tinker
>> with (it's on order as of when I'm writing this post).
>>
>> I looked in the Debian repos for stuff on Arduino and didn't find
>> much (at least not of interest to me).
>>
>> I did download the IDE from Elegoo and their tutorials and libraries.
>> But it's all in C/C++. While I do know C and C++ (to some extent),
>> I'm very bad at it (I admit to not using it very much, maybe once
>> every other blue moon and lately we haven't had any blue moons that
>> warranted using C).
>>
>> I recently been doing stuff in Python (especially for work, which is
>> not Arduino related in any way). I am really getting to like Python.
>> I have created my own Python Libraries for other things (again
>> unrelated) and even compiled them to .so (binary) using the 'cython'
>> compiler.
>>
>> While I could create C source of a Python script using cython, I
>> don't know how to compile the resulting C source and upload it to the
>> Arduino board. I would like to use gcc.
>>
>> Is there a cross-platform compiler for Arduino and gcc that anyone
>> has had experience with that works or they can recommend?
>>
>> Or some way to program in Python?
>>
> 
> 
> Sure if I was going there I wouldn't be after starting from here...
> 
> I've seen your later post, and you may indeed be overestimating what
> the Arduino can do, it's basically a very well developed ecosystem for
> a microcontroller, with lots of real-world interfaces available. Just
> for tinkering with electronics, it's fine.
> 
> If you're after a more powerful (i.e. PC-like) tinkering gadget, you
> might be better looking at the Raspberry Pi (Pi for Python) and the
> subsequent similar devices. More expensive than the Arduino, but still
> pretty cheap. The Pi runs more than one OS, but the Raspbian version of
> Debian is probably most widely-used. The Pi also has a great many
> interface devices available, and Python is the expected scripting
> language.

I will probably end up with one of those sooner or later. A friend as a 
Pi (I thought Pi meant 3.14...)

I keep hearing about Arduino and Raspberry Pi and always wondered what 
they were all about. So I chose to experiment with Arduino first. I know 
*nothing* about either at the moment. Still in the learning, Googling, 
asking stupid questions, etc. phase. :)

I think my mindset also came from my days of trying to program the 
WowWee RoboSapien RS Media (ARM/Linux with Java). That was like a fully 
programmable computer and robot all in one.

I don't mind using C, but am pretty bad at it. Maybe this is the time to 
finally get better at it.

[toc] | [next] | [standalone]


#197897

FromErik Christiansen <dvalin@internode.on.net>
Date2018-07-22 17:20 +0200
Message-ID<weojo-34U-5@gated-at.bofh.it>
In reply to#197890
On 22.07.18 10:29, cyaiplexys wrote:
> I think my mindset also came from my days of trying to program the WowWee
> RoboSapien RS Media (ARM/Linux with Java). That was like a fully
> programmable computer and robot all in one.

Then the full arduino environment will be more comfortable than raw C on
bare iron. While I program AVRs, including the ATmega328P used on most
arduino boards, in C and assembler, I understand that the arduino
environment provides a high level programming interface which allows
e.g. artists to write "sketches" to perform real-time tasks.

There is quite a bit of peripheral hardware on an ATmega328P, from
serial USART, through timer/counters useful for e.g. PWM motor control,
through multi-channel 10 bit Analogue to digital converter. The chip
datasheet is 440 pages in length, and learning to initialise and drive
the on-chip paraphernalia is a non-trivial task. The arduino environment
provides a library of drivers AIUI, to allow programming at the
application level, rather than writing your own drivers¹. It won't
necessarily give you the last microsecond of real-time performance, but
it should be a low-pain introduction. (Must be some reason for its
popularity, I figure.)

> I don't mind using C, but am pretty bad at it. Maybe this is the time to
> finally get better at it.

Learning two things at once is for self-driven stoics only, at least if
they're both non-trivial. Beginning with a friendly development
environment and application framework, complete with examples which
could be downloaded and used for tutorial purposes, avoids the pain of a
lot of stuff failing not because of coding errors, but because not yet
grokking the 440 pages of hardware spec left one bit in that other mode
enabling register unset, so it'll never work until you find the clue in
the doco.

There must be an arduino ML or forum, which would be a sanity saver.
Once master of that, then there's the AVRfreaks forum when the more
serious C journey begins.

OK, there are one or two arduinos with ARM chips, but I don't count that
as original arduino.

A raspberry Pi, running linux, would be a more familiar environment by
the sound of it. No problem running python there, but would there be
python I/O libraries?

¹ OK, drivers for e.g. 2x20 character LCDs can be found on the net, but
where there's an arduino LCD "shield" (plug-in daughterboard), there'll
be an arduino driver ready to use.

Erik

[toc] | [prev] | [next] | [standalone]


#197902

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 17:40 +0200
Message-ID<weoCJ-3cV-1@gated-at.bofh.it>
In reply to#197897
On 07/22/2018 11:13 AM, Erik Christiansen wrote:
> On 22.07.18 10:29, cyaiplexys wrote:
>> I think my mindset also came from my days of trying to program the WowWee
>> RoboSapien RS Media (ARM/Linux with Java). That was like a fully
>> programmable computer and robot all in one.
> 
> Then the full arduino environment will be more comfortable than raw C on
> bare iron. While I program AVRs, including the ATmega328P used on most
> arduino boards, in C and assembler, I understand that the arduino
> environment provides a high level programming interface which allows
> e.g. artists to write "sketches" to perform real-time tasks.

After watching some YouTube tutorials, I am starting to see that. The 
IDE isn't "real" C in that you're not directly compiling using gcc from 
the command line. It does everything for you behind the scenes. Not used 
to that since my old Windows days.

> There is quite a bit of peripheral hardware on an ATmega328P, from
> serial USART, through timer/counters useful for e.g. PWM motor control,
> through multi-channel 10 bit Analogue to digital converter. The chip
> datasheet is 440 pages in length, and learning to initialise and drive
> the on-chip paraphernalia is a non-trivial task. The arduino environment
> provides a library of drivers AIUI, to allow programming at the
> application level, rather than writing your own drivers¹. It won't
> necessarily give you the last microsecond of real-time performance, but
> it should be a low-pain introduction. (Must be some reason for its
> popularity, I figure.)

I got the starter kit with the Arduino UNO R3. Not knowing what that 
means yet (I need to read into that) I am assuming that ATmega328P is 
the Arduino MEGA and not the Arduino UNO R3? Or is it the CPU in all 
Arduinos? I'll have to look into that. I did find out a bit after my 
first post in this thread that Arduino isn't and ARM processor.

>> I don't mind using C, but am pretty bad at it. Maybe this is the time to
>> finally get better at it.
> 
> Learning two things at once is for self-driven stoics only, at least if
> they're both non-trivial. Beginning with a friendly development
> environment and application framework, complete with examples which
> could be downloaded and used for tutorial purposes, avoids the pain of a
> lot of stuff failing not because of coding errors, but because not yet
> grokking the 440 pages of hardware spec left one bit in that other mode
> enabling register unset, so it'll never work until you find the clue in
> the doco.
> 
> There must be an arduino ML or forum, which would be a sanity saver.
> Once master of that, then there's the AVRfreaks forum when the more
> serious C journey begins.

I'll have to look into these forums and find one to join. I find forums 
and lists, etc. to be indispensable when learning new stuff. And also 
even if I am good with using something (like I am with Debian), still 
having some community based help had been very useful.

> OK, there are one or two arduinos with ARM chips, but I don't count that
> as original arduino.

Maybe that was the source of my confusion. But I think I'm sure that the 
Elegoo Super Starter Kit's Arduino UNO R3 is *not* ARM. They say it's 
100% compatible with original Arduino so I assume it's got the same 
processor as the original.

> A raspberry Pi, running linux, would be a more familiar environment by
> the sound of it. No problem running python there, but would there be
> python I/O libraries?

That's ok. I am getting good enough in Python (and have made my own 
libraries at times) that if it's not there, I might be able to create 
one. Thing is, Raspberry Pi seems more like a computer, rather than a 
way to experiment controlling things (safely) like electronic circuits 
on breadboards for the fun of it.

> ¹ OK, drivers for e.g. 2x20 character LCDs can be found on the net, but
> where there's an arduino LCD "shield" (plug-in daughterboard), there'll
> be an arduino driver ready to use.
> 
> Erik

The kit comes with a LCD display, actually, and tutorials and examples 
on using it. That I know I'll find interesting too. Ever since I saw a 
video about LCD displays on a "The 8-bit guy" YouTube video, I been 
wanting to toy around with those things.

I am thinking this is going to be quite an interesting and fun hobby.

[toc] | [prev] | [next] | [standalone]


#197913

FromJoe <joe@jretrading.com>
Date2018-07-22 20:30 +0200
Message-ID<werhh-53Q-9@gated-at.bofh.it>
In reply to#197902
On Sun, 22 Jul 2018 11:34:33 -0400
cyaiplexys <cyaiplexys@sitesplace.net> wrote:

> On 07/22/2018 11:13 AM, Erik Christiansen wrote:
> > On 22.07.18 10:29, cyaiplexys wrote:  
> >> I think my mindset also came from my days of trying to program the
> >> WowWee RoboSapien RS Media (ARM/Linux with Java). That was like a
> >> fully programmable computer and robot all in one.  
> > 
> > Then the full arduino environment will be more comfortable than raw
> > C on bare iron. While I program AVRs, including the ATmega328P used
> > on most arduino boards, in C and assembler, I understand that the
> > arduino environment provides a high level programming interface
> > which allows e.g. artists to write "sketches" to perform real-time
> > tasks. 

This is the great strength of the Arduino. Run the IDE on Windows or
Linux (the program format is the same on both), select the board you
have, plug it into a serial port (USB/serial chip these days) and
you're away. The Arduino board has a built-in bootloader, meaning you
don't need a specialist programmer, just a serial port.
 
> 
> After watching some YouTube tutorials, I am starting to see that. The 
> IDE isn't "real" C in that you're not directly compiling using gcc
> from the command line. It does everything for you behind the scenes.
> Not used to that since my old Windows days.
> 
> > There is quite a bit of peripheral hardware on an ATmega328P, from
> > serial USART, through timer/counters useful for e.g. PWM motor
> > control, through multi-channel 10 bit Analogue to digital
> > converter. The chip datasheet is 440 pages in length, and learning
> > to initialise and drive the on-chip paraphernalia is a non-trivial
> > task. The arduino environment provides a library of drivers AIUI,
> > to allow programming at the application level, rather than writing
> > your own drivers¹. It won't necessarily give you the last
> > microsecond of real-time performance, but it should be a low-pain
> > introduction. (Must be some reason for its popularity, I figure.)  
> 
> I got the starter kit with the Arduino UNO R3. Not knowing what that 
> means yet (I need to read into that) I am assuming that ATmega328P is 
> the Arduino MEGA and not the Arduino UNO R3? Or is it the CPU in all 
> Arduinos? I'll have to look into that. I did find out a bit after my 
> first post in this thread that Arduino isn't and ARM processor.
> 
> >> I don't mind using C, but am pretty bad at it. Maybe this is the
> >> time to finally get better at it.  
> > 
> > Learning two things at once is for self-driven stoics only, at
> > least if they're both non-trivial. Beginning with a friendly
> > development environment and application framework, complete with
> > examples which could be downloaded and used for tutorial purposes,
> > avoids the pain of a lot of stuff failing not because of coding
> > errors, but because not yet grokking the 440 pages of hardware spec
> > left one bit in that other mode enabling register unset, so it'll
> > never work until you find the clue in the doco.
> > 
> > There must be an arduino ML or forum, which would be a sanity saver.
> > Once master of that, then there's the AVRfreaks forum when the more
> > serious C journey begins. 

At the level of the Arduino, and what it is used for, the C required
isn't going to differ too much from Python. You're mostly going to
be bit-banging. If you know one modern procedural language, you can at
least potter around in others quite easily. 
> 
> I'll have to look into these forums and find one to join. I find
> forums and lists, etc. to be indispensable when learning new stuff.
> And also even if I am good with using something (like I am with
> Debian), still having some community based help had been very useful.
> 
> > OK, there are one or two arduinos with ARM chips, but I don't count
> > that as original arduino.  
> 
> Maybe that was the source of my confusion. But I think I'm sure that
> the Elegoo Super Starter Kit's Arduino UNO R3 is *not* ARM. They say
> it's 100% compatible with original Arduino so I assume it's got the
> same processor as the original.
> 
> > A raspberry Pi, running linux, would be a more familiar environment
> > by the sound of it. No problem running python there, but would
> > there be python I/O libraries?  

The 'Pi' comes from Python, which is its intended primary user
language. Peripherals intended for the Pi will come with Python
drivers, or at least Python interfaces.

> 
> That's ok. I am getting good enough in Python (and have made my own 
> libraries at times) that if it's not there, I might be able to create 
> one. Thing is, Raspberry Pi seems more like a computer, rather than a 
> way to experiment controlling things (safely) like electronic
> circuits on breadboards for the fun of it.

It is indeed. A Pi running a Debian desktop is painfully slow, but it
works. What it's surprisingly good at is running streaming software for
Internet TV, the system is optimised for high-definition HDMI output.
Google raspberry pi tv. You won't do that on an Arduino.

> 
> > ¹ OK, drivers for e.g. 2x20 character LCDs can be found on the net,
> > but where there's an arduino LCD "shield" (plug-in daughterboard),
> > there'll be an arduino driver ready to use.
> > 
> > Erik  
> 
> The kit comes with a LCD display, actually, and tutorials and
> examples on using it. That I know I'll find interesting too. Ever
> since I saw a video about LCD displays on a "The 8-bit guy" YouTube
> video, I been wanting to toy around with those things.
> 
Wait till you've had a bit of practice with them before you try writing
a driver for a new LCD display. The documentation for them is skimpy,
and you may need to guess a bit. I've made a few for the PIC 18F
series, which is comparable to this Atmel series.

> I am thinking this is going to be quite an interesting and fun hobby.
> 

Certainly. My only work with the Arduino was using one as a graphics
co-processor for a PIC project to drive a 320x240 touch screen for a
camera control panel. There was a suitable Arduino library but not one
for the PIC, and time was in short supply. One drawback to the Arduino
here is that it doesn't have a lot of memory, so the screen fonts were
a bit chunky. 

-- 
Joe

[toc] | [prev] | [next] | [standalone]


#197917

Fromcyaiplexys <cyaiplexys@sitesplace.net>
Date2018-07-22 22:50 +0200
Message-ID<wetsK-6uK-15@gated-at.bofh.it>
In reply to#197913
On 07/22/2018 02:20 PM, Joe wrote:

...snip...

> At the level of the Arduino, and what it is used for, the C required
> isn't going to differ too much from Python. You're mostly going to
> be bit-banging. If you know one modern procedural language, you can at
> least potter around in others quite easily.

Judging by what others are saying plus what you say, it looks like 
sticking to C would actually be easier than trying to get it to work 
with Python.

...snip...

>> That's ok. I am getting good enough in Python (and have made my own
>> libraries at times) that if it's not there, I might be able to create
>> one. Thing is, Raspberry Pi seems more like a computer, rather than a
>> way to experiment controlling things (safely) like electronic
>> circuits on breadboards for the fun of it.
> 
> It is indeed. A Pi running a Debian desktop is painfully slow, but it
> works. What it's surprisingly good at is running streaming software for
> Internet TV, the system is optimised for high-definition HDMI output.
> Google raspberry pi tv. You won't do that on an Arduino.

Good thing I don't have a need for running streaming software or 
anything like that. So that's not a problem.

...snip...

>> The kit comes with a LCD display, actually, and tutorials and
>> examples on using it. That I know I'll find interesting too. Ever
>> since I saw a video about LCD displays on a "The 8-bit guy" YouTube
>> video, I been wanting to toy around with those things.
>>
> Wait till you've had a bit of practice with them before you try writing
> a driver for a new LCD display. The documentation for them is skimpy,
> and you may need to guess a bit. I've made a few for the PIC 18F
> series, which is comparable to this Atmel series.

I think what I'll be doing is just what is in the tutorials, at first. 
And toying around with what they have available. Looks like they already 
have a library built for the LCD display (it's a monochrome 20 x 40 or 
something like that) and some sample code on how to use it.

>> I am thinking this is going to be quite an interesting and fun hobby.

> Certainly. My only work with the Arduino was using one as a graphics
> co-processor for a PIC project to drive a 320x240 touch screen for a
> camera control panel. There was a suitable Arduino library but not one
> for the PIC, and time was in short supply. One drawback to the Arduino
> here is that it doesn't have a lot of memory, so the screen fonts were
> a bit chunky.

That's another thing I am noticing but a friend tells me I really won't 
need a lot of memory just for tinkering around with things. They do have 
a shield with an SD card reader/writer for it but my friend tells me 
that doesn't expand how much memory is available to store programs, but 
would only come in handy if you do a lot of writing of data or something.

Well, I guess you good folks got me straightened out. It looks like I 
won't need anything but what comes with the kit and the downloads to do 
the tinkering and will have to do it in C. I'll just forget about Python 
I guess. Not too big a problem.

I'm also amazed that Debian doesn't have much for the Arduino in the repo.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web