Can C# or Python compile to Arduino machine code?

Hey there,

Every resource I see keeps mentioning how C# or python can be run from your PC to communicate with the board. But is there some way to compile C# or Python code INTO an Arduino sketch that can then be uploaded to the board?

Thank you!

Ab

Python is a scripting language. It isn't compiled. There are some boards that can run micropython and that runs python scripts.

I don't know of anything that makes machine code from C#. AFAIK it works like Java.

actually it is, if you want

@absaintdane i used for short time an Arduino plug-in for VS Code 2019.
any way, i think, you can generate .o files and link it with avrdude

For a micro?

i have compiled Python script for Windows

The question was about Arduino, not windows.

Byte-code interpreted. With a rather large "interpreter."
IIRC, there were some arduino-size boards that claimed to run .net micro (not quite sure if that includes C#) programs directly, based on some relatively powerful ARM chips. They were pretty expensive, didn't catch on, and were discontinued; I'm not sure if there was a replacement.

The microPython (Raspberry Pi Pico) and circuitPython (many Adadfruit boards based on ARM or ESP chips) have gained more traction - they run a python interpreted on the chip. (NOT via a Python to Machine Code compiler.)

None of the AVR-based Arduinos (Uno 3, Nano v3, Nano Every, Mega V3, etc) will run either python or .net interpreters; they simply lack the resources (mostly memory.)

Hey guys, thanks for the replies!

I understand the interpreters won't run on most boards. I meant if there's a way to compile the code directly into machine code/sketch OR into C/C++ which can then be compiled into machine code/sketch.

Does that video show how to compile python code or how to use micropython?

Can you give us a few words or at least point to a spot in the video so I don't have to watch 30 minutes of that guy?

none of the above. deleted.

upd

you can use cython to generate a C file out of the Python .py file