1
0
Fork 0
ContactPi/README.md

95 lines
1.7 KiB
Markdown
Raw Normal View History

2019-11-01 10:34:57 -04:00
# onsetswitch
Use buttons connected to a Rasberry Pi GPIO to trigger Hog 4 comment macros.
2019-11-03 20:29:06 -05:00
## Prep
2019-11-01 10:34:57 -04:00
2019-11-03 20:29:06 -05:00
* Install Raspbian [the usual way.](https://www.raspberrypi.org/documentation/installation/installing-images/README.md)
* Enable the ssh server. On a mac:
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
touch /Volumes/boot/ssh
```
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Eject the SD card and boot the Raspberry Pi.
* Use SSH to log into the Pi:
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
ssh pi@raspberrypi
```
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Use raspi-config to;
2019-11-04 10:50:38 -05:00
```sh
sudo raspi-config
```
2019-11-03 20:29:06 -05:00
* set locale
* set timezone
* enable ssh server
* enlarge the file-system to fill the SD card
* reboot
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Update the Apt and install aptitude
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
sudo apt-get update
sudo apt-get install aptitude
```
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Use aptitude to upgrade the Pi.
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
sudo aptitude upgrade
```
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Reboot the Pi.
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
sudo shutdown -r now
```
2019-11-04 10:50:38 -05:00
2019-11-03 20:29:06 -05:00
* Logging back into the Pi, install sane set of software packages.
2019-11-04 10:50:38 -05:00
```sh
2019-11-03 20:29:06 -05:00
sudo aptitude install git python3-pip python3-gpiozero
sudo pip3 install gpiozero antlr4-python3-runtime python-osc
```
2019-11-01 10:34:57 -04:00
## Installing
2019-11-04 10:50:38 -05:00
```sh
2019-11-01 10:34:57 -04:00
cd /home/pi
2019-11-03 20:29:06 -05:00
git clone --recurse-submodules https://git.company235.com/kevin/onsetswitch.git
2019-11-01 10:34:57 -04:00
cd onsetswitch
```
2019-11-04 10:50:38 -05:00
2019-11-01 10:34:57 -04:00
## Configuring
### Input
Connect one side of the button to ground, the other to a GPIO pin.
![](https://gpiozero.readthedocs.io/en/stable/_images/button_bb.svg)
Configure the buttons:
2019-11-04 10:50:38 -05:00
```sh
2019-11-01 10:34:57 -04:00
nano buttons.cfg
```
### Output
Configure the Hog4 OSC server:
2019-11-04 10:50:38 -05:00
```sh
2019-11-01 10:34:57 -04:00
nano server.cfg
```
## Enabling on Boot
Link the onsetswitch service file to systemd:
```
sudo cp buttons.service /lib/systemd/system/buttons.service
2019-11-01 10:34:57 -04:00
```
Enable the service at startup:
2019-11-04 10:50:38 -05:00
```sh
2019-11-01 10:34:57 -04:00
sudo systemctl daemon-reload
sudo systemctl enable buttons.service
```
Start the buttond service:
```
sudo systemctl start buttons.service
sudo systemctl status buttons.service
2019-11-01 10:34:57 -04:00
```