Skip to content

Instantly share code, notes, and snippets.

Kohei MATSUSHITA ma2shita

Block or report user

Report or block ma2shita

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ma2shita
ma2shita / m5stack_mqtt_with_soracom_beam_least.ino
Created Feb 5, 2020
MQTT Pub/Sub with SORACOM Beam for M5Stack
View m5stack_mqtt_with_soracom_beam_least.ino
/* MQTT Pub/Sub with SORACOM Beam for M5Stack */
/*
* Copyright (c) 2020 Kohei "Max" MATSUSHITA
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <string.h>
#include <stdio.h>
View WioLTE_rcs620s.ino
/*
* Modified to Lib (`Serial` to `Serial1`)
*/
#include <WioLTEforArduino.h>
WioLTE Wio;
#define CONSOLE SerialUSB
#include <RCS620S.h>
RCS620S rcs620s;
View measurement_co2_by_S300L_for_wiolte.ino
/* Measurement CO2 by S-300L-3V for Wio LTE JP Version */
/* Output >>
Ready
862
866
871
875
877
*/
View measurement_co2_by_S300L_for_arduino_uno_r3.ino
/* Measurement CO2 by S-300L-3V for Arduino UNO R3 */
/* Output >>
Ready
862
866
871
875
877
*/
View Wio_multithread_by_pt.ino
#include <WioCellLibforArduino.h> /* for Wio3G */
#define CONSOLE SerialUSB
#include <pt.h>
/* PT_WAIT is very useful macro. delay() similar using. https://qiita.com/narumi18wa/items/070d3e5b2a18c4976304 */
#define PT_WAIT(pt, timestamp, usec) PT_WAIT_UNTIL(pt, millis() - *timestamp > usec);*timestamp = millis();
static struct pt pt1, pt2, pt3;
static int thread1(struct pt *pt) {
static unsigned long timestamp = 0; /* unit=ms; timestamp used as a ref in thread */
@ma2shita
ma2shita / emit_data_a.service
Created Nov 26, 2019
systemd unit file for `emit_data_a.bash`
View emit_data_a.service
[Unit]
Description = Emit data for Product Line demo on SORACOM Lagoon
[Service]
Type = simple
WorkingDirectory = /home/USERNAME/productline-demo/
ExecStart = /bin/bash emit_data_a.bash
[Install]
WantedBy = default.target
@ma2shita
ma2shita / emit_data_a.bash
Last active Nov 26, 2019
Emit virtual data for Product Line demo on SORACOM Lagoon
View emit_data_a.bash
#!/bin/bash
source emit_data_a.key # export D_KEY=... ; export D_SEC=... from SORACOM Inventory virtual device
echo "Target device is ${D_ID}"
trap "echo 'done.' ; exit 0" 1 2 3 15
while true
do
if [ $(($RANDOM % 100)) -lt 15 ]; then
View devfesta2019-azurefunctions.js
const http = require('https');
module.exports = function (context, req) {
context.log(req);
const url = process.env[`WEBHOOK_URL`];
const postBody = req.rawBody;
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(postBody)
@ma2shita
ma2shita / timer_shooting.timer
Last active Nov 8, 2019
Let's try IoT Prototyping / Fixed point camera with RPi (timer_shooting / timer of systemd)
View timer_shooting.timer
[Unit]
Description = Shooting camera client (timer)
[Timer]
OnBootSec = 1m
OnUnitActiveSec = 10m
[Install]
WantedBy = timers.target
@ma2shita
ma2shita / timer_shooting.service
Last active Nov 8, 2019
Let's try IoT Prototyping / Fixed point camera with RPi (timer_shooting / service of systemd)
View timer_shooting.service
[Unit]
Description = Shooting camera client by timer (implementation)
[Service]
Type = simple
ExecStart = /bin/bash /home/pi/timer_shooting.bash
[Install]
WantedBy = timer_shooting.timer
You can’t perform that action at this time.