Create project, with script and README
This commit is contained in:
commit
87d249e035
49
README.md
Normal file
49
README.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Installation scripts to use Wokwi and Arduino in VSCode/VSCodium
|
||||||
|
|
||||||
|
## Installation steps
|
||||||
|
|
||||||
|
### Install Dependencies
|
||||||
|
|
||||||
|
Instal the xdotool package:
|
||||||
|
|
||||||
|
Debian based distros:
|
||||||
|
`sudo apt install xdotool`
|
||||||
|
|
||||||
|
Arch based distros:
|
||||||
|
`sudo pacman -S xdotool`
|
||||||
|
|
||||||
|
### VSCode/VSCodium configuration
|
||||||
|
|
||||||
|
Install the Wokwi extension and request the license key [here](https://wokwi.com/license):
|
||||||
|
|
||||||
|
Extension for VSCode [here](https://marketplace.visualstudio.com/items?itemName=Wokwi.wokwi-vscode)
|
||||||
|
|
||||||
|
Extension for VSCodium [here](https://open-vsx.org/extension/Wokwi/wokwi-vscode)
|
||||||
|
|
||||||
|
To activate the license key open the IDE press `F1` and select `Wokwi: Manually Enter License Key` and paste the license key
|
||||||
|
|
||||||
|
### Installation Script
|
||||||
|
|
||||||
|
For linux execute the `install-linux.sh` script
|
||||||
|
|
||||||
|
## After the installation process
|
||||||
|
|
||||||
|
After the installation is completed you will have the following project structure:
|
||||||
|
|
||||||
|
### Project Structure
|
||||||
|
|
||||||
|
.vscode/ --> VSCode config files
|
||||||
|
run
|
||||||
|
tasks.json
|
||||||
|
bin/ --> Binnaries and executables
|
||||||
|
arduino-cli
|
||||||
|
code/ --> Main project code directory
|
||||||
|
code.ino
|
||||||
|
libs/ --> Arduino library's
|
||||||
|
.gitignore
|
||||||
|
diagram.json --> Wokwi diagram/circuit
|
||||||
|
wokwi.toml --> wokwi config file
|
||||||
|
|
||||||
|
### How to use
|
||||||
|
|
||||||
|
You can compile and execute the arduino project/sketch just by pressing `Ctrl` + `Shift` + `B`.
|
||||||
85
install-linux.sh
Executable file
85
install-linux.sh
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Create dirs
|
||||||
|
|
||||||
|
mkdir .vscode bin libs
|
||||||
|
|
||||||
|
# create files
|
||||||
|
|
||||||
|
echo "
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
./bin/arduino-cli compile --fqbn arduino:avr:uno code --libraries ./libraries/ --build-path ./build --clean
|
||||||
|
|
||||||
|
echo \"Starting simulation...\"
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
xdotool key ctrl+shift+p
|
||||||
|
xdotool type \"Wokwi: Start Simulation\"
|
||||||
|
xdotool key Return
|
||||||
|
" >> .vscode/run
|
||||||
|
|
||||||
|
chmod +x .vscode/run
|
||||||
|
|
||||||
|
echo "
|
||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
\"version\": \"2.0.0\",
|
||||||
|
\"tasks\": [
|
||||||
|
{
|
||||||
|
\"label\": \"Run\",
|
||||||
|
\"type\": \"shell\",
|
||||||
|
\"command\": \"\${workspaceFolder}/.vscode/run\",
|
||||||
|
\"group\": {
|
||||||
|
\"kind\": \"build\",
|
||||||
|
\"isDefault\": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
" >> .vscode/tasks.json
|
||||||
|
|
||||||
|
echo "
|
||||||
|
build/
|
||||||
|
|
||||||
|
" >> .gitignore
|
||||||
|
|
||||||
|
echo "
|
||||||
|
{
|
||||||
|
\"version\": 1,
|
||||||
|
\"author\": \"Anonymous maker\",
|
||||||
|
\"editor\": \"wokwi\",
|
||||||
|
\"parts\": [ { \"type\": \"wokwi-arduino-uno\", \"id\": \"uno\", \"top\": -28.2, \"left\": -10.2, \"attrs\": {} } ],
|
||||||
|
\"connections\": [],
|
||||||
|
\"dependencies\": {}
|
||||||
|
}
|
||||||
|
" >> diagram.json
|
||||||
|
|
||||||
|
echo "
|
||||||
|
[wokwi]
|
||||||
|
version = 1
|
||||||
|
firmware = 'build/code.ino.hex'
|
||||||
|
elf = 'build/code.ino.elf'
|
||||||
|
" >> wokwi.toml
|
||||||
|
|
||||||
|
# get arduino-cli
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
wget https://github.com/ebranlard/xdotool-for-windows/raw/master/_bin/xdotool.exe
|
||||||
|
wget https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
|
||||||
|
tar xvf arduino-cli_latest_Linux_64bit.tar.gz
|
||||||
|
rm arduino-cli_latest_Linux_64bit.tar.gz
|
||||||
|
rm LICENSE.txt
|
||||||
|
|
||||||
|
./arduino-cli core install arduino:avr
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
./bin/arduino-cli sketch new code
|
||||||
|
|
||||||
|
|
||||||
|
rm -rf README.md
|
||||||
|
rm -rf .git/
|
||||||
|
rm -rf install.sh
|
||||||
Loading…
x
Reference in New Issue
Block a user