1

I just got started with Arduino, and found out that I need the IDE to compile and upload codes, which works perfectly fine. This is my code:

# pragma GCC optimize ("Ofast")

char i = 0 ;
unsigned long time, lastTime ;

void setup() {
    pinMode(LED_BUILTIN, OUTPUT) ;
}

void loop() {
    time = millis() ;
    
    if (time > lastTime) {
        lastTime = time + 100 ;
        i = ~i ;
        digitalWrite(LED_BUILTIN, i  ? HIGH : LOW) ;
    }
}

But the biggest problem is that the IDE is written in Java and it uses 1 GB of system's memory, and it's very heavy.

So is there a way I can use the Linux command line to compile and upload the code to the Arduino UNO?

1
  • 1
    You can also try PlatformIO, which offers a similarly integrated experience. It uses VScode which is Electron based, so it's only slightly lighter. – AndreKR Apr 16 at 20:01
4

Yes, I haven't used it but on the official page it is mentioned, called Arduino CLI (command line interface), available for Mac and Linux.

https://www.arduino.cc/pro/cli

Excerpt:

Arduino CLI is a command line tool that contains all you need to easily build applications around the Arduino ecosystem. Parse the JSON output of the CLI or implement it as an always-on service that accepts commands via a gRPC interface using your language of choice.

Arduino CLI is the backbone of the Arduino Create Web Editor serving over a million users.

Also, it's open source and can be found on GitHub at https://github.com/arduino/arduino-cli/releases

2
  • 1
    I use arduino-cli all the time now. It's so much better than fighting with the IDE - at least for someone like me brought up on programming in vi... – Majenko Apr 16 at 11:31
  • @Majenko vi is a long time ago for me ... at my current project I'm using Visual Studio as I stubbed all Arduino and Arduino library functions so I have a working executable on my PC, and since it's in the same directory as the .ino file I only hit the 'Compile' (and or upload) button of the Arduino IDE which is the only thing I use. (btw, I'm intending to move to platformio and using ESP32 soon). For me the Arduino IDE is also quite a bad IDE (good for very small one file programs (which as OO programmer is barely the case for me). – Michel Keijzers Apr 16 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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