-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.bat
44 lines (33 loc) · 881 Bytes
/
compile.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@echo off
setlocal
REM Find arduino-cli.exe
set "IDE_PATH="
if exist "C:\Program Files\Arduino IDE" (
set "IDE_PATH=C:\Program Files\Arduino IDE"
) else if exist "%LOCALAPPDATA%\Programs\Arduino IDE" (
set "IDE_PATH=%LOCALAPPDATA%\Programs\Arduino IDE"
)
if not defined IDE_PATH (
echo Error: Arduino IDE installation not found.
pause
goto :EOF
)
set "ARDUINO_CLI=%IDE_PATH%\resources\app\lib\backend\resources\arduino-cli.exe"
if not exist "%ARDUINO_CLI%" (
echo Error: arduino-cli.exe not found at the expected location.
pause
goto :EOF
)
REM Set variables for the sketch and port
set "SKETCH_DIR=%CD%"
set "PORT=COM3"
set "FQBN=arduino:avr:nano"
"%ARDUINO_CLI%" compile -e --fqbn %FQBN% "%SKETCH_DIR%"
if errorlevel 1 (
echo Error: Failed to upload the sketch.
pause
goto :EOF
)
echo Compilation successful.
pause
endlocal