#!/bin/bash

# get serial port via board list, choose lines including "USB", and pick up 1st word
serial=`arduino-cli board list | grep USB | awk '{print $1}'`

echo ${serial}
if [ -z "${serial}" ]; then
  echo "No device connected."
  exit  
fi

# open serial monitor (CTRL+C to quit)
arduino-cli monitor -p ${serial} --config baudrate=115200 
