Programming Arduino with Python or Asm

Been looking around for a few days now and have not seen any reference to using Python or Assembly to program an UNO R3 CH340G. I prefer either or these in comparison to the C language. Is anyone working in Python and will or will not work with it?

Thanks

Jim

You can't do it with python, but you definitely can do it with assembly. There are tutorial on the webs

thanks.. guess I better go get my old C manuals out..

thanks again..

Jim

This might be helpful to get you started with programming your Uno using assembly in the Arduino IDE: https://forum.arduino.cc/index.php?topic=413151.msg2844634#msg2844634

Although not supported by the Uno, there are a couple of popular projects that allow you to program microcontrollers using Python:

These can both be used with microcontrollers that are also popular in the Arduino world.

Python is definitly better choice than c languages ;)

sophiasmith2018: Python is definitly better choice than c languages ;)

Not for an Arduino UNO.

sophiasmith2018: Python is definitly better choice than c languages ;)

That suggests that you are not aware of the difference between interpreted and compiled programming languages.

...R

How many bytes of memory does a Python interpreter require?

Robin2: That suggests that you are not aware of the difference between interpreted and compiled programming languages.

...R

I know difference - but you cannot argue that python is more easy for programming and there is a lot tool to compile python into machine language

I should say that I wasn't necessarily recommending Python (or assembly for that matter). I'm a big fan of a sane use of C++ for embedded systems programming.

I have been hearing some positive comments about Circuit Python lately. Surprisingly, I haven't heard much about micropython in a while.

I'd rather see the focus remain on Arduino instead of the community's efforts being split between Arduino and Circuit Python. For someone getting started in embedded systems with a lot of experience with Python I think it could be a nice option. For someone with no prior experience in Python, C, or C++ I'd still recommend C++. Python does have its advantages but I really didn't find C++ so difficult as a beginner. I actually started learning Python before getting involved with Arduino and I'm now much better in C++ than Python.

sophiasmith2018: Python is definitly better choice than c languages ;)

...and yet the number of embedded programming jobs I've worked on in the last thirty years, where Python was a requirement, can't even be counted on the fingers of one finger.

pert: I should say that I wasn't necessarily recommending Python (or assembly for that matter). I'm a big fan of a sane use of C++ for embedded systems programming.

I have been hearing some positive comments about Circuit Python lately. Surprisingly, I haven't heard much about micropython in a while.

I'd rather see the focus remain on Arduino instead of the community's efforts being split between Arduino and Circuit Python. For someone getting started in embedded systems with a lot of experience with Python I think it could be a nice option. For someone with no prior experience in Python, C, or C++ I'd still recommend C++. Python does have its advantages but I really didn't find C++ so difficult as a beginner. I actually started learning Python before getting involved with Arduino and I'm now much better in C++ than Python.

Hi,

I could threat with making a brainy reasoning on computer hardware and software evolution from the 70's till today ... I won't (it'd be several pages long and, probably, partially wrong, needless and useless).

I'd, instead, pose a single idea: the hardware growing power (it doubles every two years?) and the -not so brilliant but equally evident- software -products and scientifics- evolution make: 1) possible projects that weren't at all a decade ago; 2) affordable those that weren't not many years ago and, the most important form my point of view, 3) much cheaper and less time consuming conventional projects (whatever "conventional" may mean ...).

Using and learnig Python is, by far, faster and easier than C++ (I've said "using", not "running"). On the other hand, hardware -much- cheaper and powerful products (being the SAM family controllers a good example) invite to use them if the developpement time is to be -much- shorter.

Counterfacts are evident, perhaps being the execution time the most important, but: how many projects are 'time not critical' ones (compared to the ones in that a uS makes the difference?).

(At least this is my -brainy- opinion).

Best regards.

vffgaston: I'd, instead, pose a single idea: the hardware growing power (it doubles every two years?)

And this is exactly what has made Python in embedded systems possible. There is no way Python would ever be practical on an ATmega328P but on an STM32, ESP8266, ATSAMD21, etc. board you have plenty of memory and clock cycles to fit a reasonable sized project and an interpreter even if the code is not as efficient as it could be.

For a hobbyist, spending an extra $1 for a microcontroller with the extra capacity to allow for an easier programming experience is no big deal. For a mass manufactured product it will be worth paying the salaries of the programmers for the extra time to write efficient code that can fit on a slightly cheaper microcontroller.

vffgaston: how many projects are 'time not critical' ones (compared to the ones in that a uS makes the difference?).

Power efficiency is becoming increasingly more important as so many embedded devices are trying to do a lot on battery power in a small package. Maximum power efficiency comes from efficient code (every clock cycle while awake counts). Code written in Python will never be as efficient. This is an important factor even for some hobbyist projects.

So to me it seems like Python is good for a hobbyist but will rarely be the choice for a professional embedded systems programmer. Is it really worth it for a professional to learn an additional language just for the rare cases where Python does make sense to use? The thing I really like about Arduino is that, even though it's meant for beginners and hobbyists, the knowledge gained could be applied directly to a professional career if that's where it takes you. If you get started with Python and then decide to embark on a career in embedded systems programming all your Python programming skills you learned will not be used and you're going to need to learn C/C++ instead.

sophiasmith2018: and there is a lot tool to compile python into machine language

So as this thread is about the Arduino UNO, can you point me at a tool that will take a Python program and turn it into a program that will run on an Arduino UNO ?

pert: And this is exactly what has made Python in embedded systems possible. There is no way Python would ever be practical on an ATmega328P but on an STM32, ESP8266, ATSAMD21, etc. board you have plenty of memory and clock cycles to fit a reasonable sized project and an interpreter even if the code is not as efficient as it could be.

Hi,

This is exactly the kind of dicussion I wanted to start with my post ...

The reasoning is going to be philosophical rather than a technical/economical one (in this arena I'd agree with you 99% of your post): The main question is: Is the arduino project addressed only to developpers?. (Look that I've said "project", not "forum").

Sure we would have to ask Benzi, Cuartielles & Co to make sure, but I can still remenber the first notice I had on arduino: Benzi striving to teach the viewer (it was a youtube video) how to switch on a LED by means of a switch both connected to an arduino UNO. Not much on an embedded systems; even more, there's a long, long way beetwen a LED, a switch and an embedded device.

pert: For a hobbyist, spending an extra $1 for a microcontroller with the extra capacity to allow for an easier programming experience is no big deal. For a mass manufactured product it will be worth paying the salaries of the programmers for the extra time to write efficient code that can fit on a slightly cheaper microcontroller.

This is a different issue: is "spending an extra $1 for a microcontroller with the extra capacity to allow for an easier programming experience" "not a big deal". I'm not sure if saying "1$" means exactly 1$ (I'm spaniard), but the fact is that, in many cases it is just a "1$" -or less- deal. Do you think that such a small quantity(es) pays a hobbyst the effort of learning "C++" instead of using python?; I'm not sure on this neither.

pert: So to me it seems like Python is good for a hobbyist but will rarely be the choice for a professional embedded systems programmer. Is it really worth it for a professional to learn an additional language just for the rare cases where Python does make sense to use? The thing I really like about Arduino is that, even though it's meant for beginners and hobbyists, the knowledge gained could be applied directly to a professional career if that's where it takes you. If you get started with Python and then decide to embark on a career in embedded systems programming all your Python programming skills you learned will not be used and you're going to need to learn C/C++ instead.

I'm back on the first paragraph: who said that arduino is just a (such a) professional bussines (arduino, I insist). Even more: who said that using a M0 with python is not reasonable for certain projects?. What if I just want to make a few units of a greenhouse monitoring (two or three temperatures and soil moisture sensors; a couple of relays) system for some of my friends?. Should I allways use a vintage road bike (with those awfull gears) to climb the Tourmalet or may I use a mountain bike to do the same?

Best regards.

But why use a language with a lot of overhead on a system that is made to use as few as resources possible?

I'm back on the first paragraph: who said that arduino is just a (such a) professional bussines (arduino, I insist). Even more: who said that using a M0 with python is not reasonable for certain projects?. What if I just want to make a few units of a greenhouse monitoring (two or three temperatures and soil moisture sensors; a couple of relays) system for some of my friends?. Should I allways use a vintage road bike (with those awfull gears) to climb the Tourmalet or may I use a mountain bike to do the same?

What do you mean by this? What language is the vintage bike and what is the mountain bike? A better analogy, i think, is C/C++ is the professional lightweight carbon bike, and python is the plain old city bike. Both will get you to the top, only the carbon bike will do it faster with less effort.

For my own, I use python to quickly setup a test project and to see if my math is correct. If it works I write the program into the arduino.

Speklap: But why use a language with a lot of overhead on a system that is made to use as few as resources possible?

What do you mean by this? What language is the vintage bike and what is the mountain bike? A better analogy, i think, is C/C++ is the professional lightweight carbon bike, and python is the plain old city bike. Both will get you to the top, only the carbon bike will do it faster with less effort.

For my own, I use python to quickly setup a test project and to see if my math is correct. If it works I write the program into the arduino.

Hi,

As I see it, even a microcontroller can be used for tasks quite different from a math calculation ... Think on a system that receives a few digital/analog signals and has to navigate into a finite state machine to detect some state that is at the end of a logical laberinth. Or you just want to use a small alphanumerical display to implement a basic dialog with the user.

Do you really think that it always deal with calculatios and/or milliseconds?. Can't you imagine a system that asks for an arduino but has not to be, fatally, to be programmed in C?

Regards

vffgaston: Is the arduino project addressed only to developpers?. (Look that I've said "project", not "forum").

...

who said that arduino is just a (such a) professional bussines (arduino, I insist).

The Arduino project is for everyone. That includes artists, hobbyists, but also aspiring professionals. You can take it as far as you like. Arduino makes it easy to learn but what you learn is a professional programming language that is probably the second most commonly used language for embedded systems programmers. The most commonly used language is C and you'll essentially know that too. Python will not take you past the hobbyist level.

vffgaston: Do you think that such a small quantity(es) pays a hobbyst the effort of learning "C++" instead of using python?

Of course not. I already said that. But when you're developing a product that will be made in quantities of hundreds of thousands or millions a small savings on the microcontroller will pay the effort of the programmers spending a little more time to write the code in C/C++ instead of Python. I brought this up as an argument against Python ever being commonly used by professional embedded systems programmers.

vffgaston: As I see it, even a microcontroller can be used for tasks quite different from a math calculation ... Think on a system that receives a few digital/analog signals and has to navigate into a finite state machine to detect some state that is at the end of a logical laberinth. Or you just want to use a small alphanumerical display to implement a basic dialog with the user.

Ok, let's ditch the math. Let's make indeed a system that receives a couple of signals every 5 minute or so, and acts upon it. Such a device will probably be off the grid powered by batteries. So you want to use as few as cycli as possible so it can run for as long as possible. Coding this with python will cost extra cycli which will result in a lesser online time.

You only have 16MHz, using a part of them to be able to run python code is a waste imo. Yes, driving a display is possible in python. But driving a display, checking an input pin at 100kHz, doing adc conversion, do a bit of basic math, you will go to the limit. What I'm trying to get to, is that as a hobbyist, you will run into the 16MHz if you're using python and have a reasonable project. You will find yourself going to C/C++.

Again, why use extra resources on a system that is made to minimalize the resource needed. Learning C/C++ isn't that hard after python. Most things are similar. Once you can program, it's easy to switch to another language.

Also, wouldn't python take more RAM and memory? Since it's a scripted language and doesn't know what's ahead.

vffgaston: This is exactly the kind of dicussion I wanted to start with my post ...

Why would you want to hijack and derail the OP's Thread in which it was stated very clearly in the Original Post that s/he is using an Uno

...R