This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BCM_PIN=6 | |
trap 'exit 0' 1 2 3 15 | |
function _gpio_read() { | |
# $1 = reading GPIO pin (number of BMC pin) | |
raspi-gpio get $1 | awk -v RS=" " -F "=" -v k="level" '$1==k {print $2}' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = Shooting camera server (listener) | |
[Socket] | |
ListenStream = 127.0.0.1:19000 | |
Accept = yes | |
[Install] | |
WantedBy = sockets.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = Shooting camera server (implementation) | |
[Service] | |
ExecStart = /bin/bash /home/pi/camera_shooting.bash | |
StandardInput = socket | |
StandardOutput = journal | |
StandardError = journal | |
[Install] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "$0" | |
read LINE | |
if [ "$LINE" = "shooting!" ]; then | |
echo "Taking a Photo!" | |
fswebcam -q --device /dev/video0 - \ | |
| curl -X POST -H 'Content-Type: image/jpeg' --data-binary '@-' --connect-timeout 15 harvest-files.soracom.io | |
fi | |
echo "$0 END" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[Unit] | |
Description=Garage reporter using HTTP with SORACOM Unified Endpoint | |
After=network-online.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/pi/switchbot | |
ExecStart=/home/pi/switchbot/bin/python3 -B garage_reporter_with_soracom_unified.py | |
ExecStop=/bin/kill -INT ${MAINPID} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[Unit] | |
Description=SwitchBot worker using MQTT with SORACOM Beam | |
After=network-online.target | |
[Service] | |
Type=simple | |
WorkingDirectory=/home/pi/switchbot | |
ExecStart=/home/pi/switchbot/bin/python3 -B switchbot_worker_with_soracom_beam.py | |
ExecStop=/bin/kill -INT ${MAINPID} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import VL53L0X | |
# Create a VL53L0X object | |
tof = VL53L0X.VL53L0X(i2c_bus=1, i2c_address=0x29) | |
# I2C Address can change before tof.open() | |
# tof.change_address(0x32) | |
tof.open() | |
# Start ranging | |
tof.start_ranging(VL53L0X.Vl53l0xAccuracyMode.BETTER) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define CONSOLE Serial | |
#define MODEM Serial2 /* Serial2 is Modem of 3G Module */ | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define CONSOLE Serial | |
#define MODEM Serial2 /* Serial2 is Modem of 3G Module */ | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2019 Kohei "Max" MATSUSHITA | |
* Released under the MIT license | |
* https://opensource.org/licenses/mit-license.php | |
*/ | |
#include <M5Stack.h> | |
#define TINY_GSM_MODEM_UBLOX | |
#include <TinyGsmClient.h> |