diff --git a/README.md b/README.md index ec38ba9..ee8d1a2 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,11 @@ documentation](http://mjo.tc/atelier/2009/02/arduino-cli.html "Documentation") exists. If you're using Debian or Ubuntu, you can find this in the arduino-core package. + +## Commands + +### Serial Monitor + +If you have minicom installed, you can run `make monitor` to open the serial +output. You can use a different serial monitoring tool (e.g. screen) by +overriding the `SERIAL_MONITOR_BINARY` and `SERIAL_MONITOR_FLAGS` variables. diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk index 2d39095..3e7dfe1 100644 --- a/arduino-mk/Arduino.mk +++ b/arduino-mk/Arduino.mk @@ -448,6 +448,26 @@ endif AVRDUDE_ISP_OPTS = -P $(ISP_PORT) $(ISP_PROG) +####################################################################### +# +# Serial monitoring +# + +ifndef SERIAL_MONITOR_BAUDRATE +SERIAL_MONITOR_BAUDRATE = 9600 +endif + +ifndef SERIAL_MONITOR_BINARY +SERIAL_MONITOR_BINARY = minicom +endif + +ifndef SERIAL_MONITOR_FLAGS +SERIAL_MONITOR_FLAGS = -b $(SERIAL_MONITOR_BAUDRATE) -D $(ARDUINO_PORT) +endif + +ifndef SERIAL_MONITOR_COMMAND +SERIAL_MONITOR_COMMAND = $(SERIAL_MONITOR_BINARY) $(SERIAL_MONITOR_FLAGS) +endif ######################################################################## # @@ -505,6 +525,9 @@ depends: $(DEPS) size: $(OBJDIR) $(TARGET_HEX) $(SIZE) $(TARGET_HEX) +monitor: + $(SERIAL_MONITOR_COMMAND) + show_boards: $(PARSE_BOARD) --boards