Skip to main content
1 of 3
user avatar
user avatar

Generally you'll need to state the setup() and loop() functions, they are just wrappers of the IDE:

void setup() {}
void loop() {}


int main() {
  setup();
  while (1)
    loop();
    
  return 0; // never reached
}

This works both in the IDE and on the command line. As you specify the Board and SerialPort in the IDE, you'll need also to specify both in the Makefile. So you end up with two configurations.

Many people leave the IDE because they prefer use different Editors or have more configuration options by setting the compiler and linker switches.

To make it really easy, you can use Arduino Makefile today starred with 347.

Here an example Makefile:

# 
include /usr/share/arduino/Arduino.mk
ARDUINO_DIR = /usr/share/arduino
# see with: make show_boards
BOARD_TAG = promicro16
ARDUINO_LIBS = EEPROM 
MONITOR_CMD = picocom -b 9600
OPTIMIZATION_FLAGS = -Os -fexpensive-optimizations -fstrength-reduce

The '*.ino' files don't need to be changed.

user3028