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?
-
1You can also try PlatformIO, which offers a similarly integrated experience. It uses VScode which is Electron based, so it's only slightly lighter.AndreKR– AndreKR04/16/2021 20:01:18Commented Apr 16, 2021 at 20:01
1 Answer 1
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
-
1I 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 invi
...Majenko– Majenko04/16/2021 11:31:45Commented Apr 16, 2021 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– Michel Keijzers04/16/2021 11:45:14Commented Apr 16, 2021 at 11:45