summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2024-06-10 23:44:02 +0100
committerKai Stevenson <kai@kaistevenson.com>2024-06-10 23:44:02 +0100
commit3b2c796b07e8304ea4047c656d362a52ac3e7388 (patch)
treebe3ce7f05256c43734a20f286fc6a633ec55febc
parent8edca67d9b427401d7e57131d2d58d6d8018c852 (diff)
added failsafe if board detection fails
-rw-r--r--upload.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/upload.sh b/upload.sh
index b74e057..4d7589c 100644
--- a/upload.sh
+++ b/upload.sh
@@ -1,4 +1,8 @@
BOARD="arduino:avr:uno"
PORT=$(arduino-cli board list | grep dev | grep -o '^\S*')
+if [ -z $PORT ];
+then
+ return "Failed to find board"
+fi
arduino-cli compile -b $BOARD
arduino-cli upload -p $PORT -b $BOARD