1

I want to compile a sketch on Arduino Uno, while Arduino is running and not connected to anything else, and then run the compiled sketch automatically.

Is this feasible?

How?

2
  • maybe yes, google arduino forth .... here is one of the search hits arduino-forth.com
    – jsotola
    Apr 9, 2020 at 20:01
  • While the answer is no, jsotola's suggestion might be a work-around. Forth is an interpreted language. Python would be another option.
    – Duncan C
    Apr 10, 2020 at 12:04

2 Answers 2

1

No, not feasable, not possible.

The Arduino runs machine code and it does not have enough space or computation power for a compiler (also there is simply no version of the avr C++ compiler for the AVR platform, for obvious reasons). Also it is internally hardwired to run code from the flash memory. You cannot execute code from RAM. The Arduino is a microcontroller, not a computer. (Here I mean computer as something like: Has a microprocessor to execute code from RAM; has an OS; has huge amount of resources in relation to the average microcontroller)

Also: "not connected to anything else" --> Then how would you interact with the Arduino, writing the code, triggering compilation?

If this is about the cable connection, you can implement programming over bluetooth through the HC-05 module (google for it, there should be plenty of tutorials out there). Or go away from the Arduino and change to an ESP, so that you can do Over The Air (OTA) updates over wifi.

Or you could change to a minicomputer like the Raspberry Pi Zero, which is just a little bigger than the Arduino Nano and smaller than the Uno. (Though that hardly depends on the goal, what you are trying to achieve. Microcontrollers are sometimes better used for specific tasks in contrast to minicomputers)

0

No. It's not feasible.

The Uno cannot compile. The Uno cannot run code from RAM. The Uno is not a computer.

You might be able to find some small scripting language that could run on an Uno, but TBH the Uno is so underpowered you'd be able to do little more than blink an LED...

3
  • Of course it's a computer. It's just a computer with limited function. As a single function microcontroller it's ideal for a vast number of purposes not just blinking LEDs.
    – Dougie
    Apr 9, 2020 at 20:25
  • It may be a computing device, but it's not a "computer" - as in that big box on your desk with a screen and keyboard.
    – Majenko
    Apr 9, 2020 at 20:48
  • @Dougie and the "little more than blinking a LED" is in the context of trying to use a scripting language. You know, you really should learn to read the whole of an answer, not just pick out individual short phrases and pick at them like a complete pedantic ****.
    – Majenko
    Apr 9, 2020 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.