Skip to content

Instantly share code, notes, and snippets.

View ma2shita's full-sized avatar

Kohei MATSUSHITA ma2shita

View GitHub Profile
@ma2shita
ma2shita / lagoon_template_for_m5stack_tof_ranger2.json
Last active December 6, 2020 03:49
ToF ranger with 3G ext. board and SORACOM UnifiedEndpoint for M5Stack / See: https://soracom.github.io/iot-recipes/poka-yoke-for-coffee-dispenser-by-m5stack/
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@ma2shita
ma2shita / m5stack_tof_ranger2.ino
Last active January 13, 2023 06:56
ToF ranger with 3G ext. board and SORACOM UnifiedEndpoint for M5Stack / See: https://soracom.github.io/iot-recipes/poka-yoke-for-coffee-dispenser-by-m5stack/
/*
* Copyright (c) 2022 SORACOM, INC.
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <M5Stack.h>
#include <numeric>
#include <HTTPClient.h> // Why? see https://qiita.com/ma2shita/items/97bf1a0c3158b848019a
#define SerialMon Serial
@ma2shita
ma2shita / sensor_test.py
Last active August 31, 2020 03:40
Ultrasonic Range sensor (US-100) test code (Let's try IoT Prototyping / MFT2020)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
# 距離を読む関数
def read_distance():
# 必要なライブラリのインポート・設定
import RPi.GPIO as GPIO
# 使用するピンの設定
/*
* "Take a thing" notifier with 3G (All-in the edge)
*
* Copyright (c) 2020 Kohei MATSUSHITA
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <M5Stack.h>
#define console Serial
/*
* "Take a thing" notifier with 3G (All-in the cloud)
*
* Copyright (c) 2020 Kohei MATSUSHITA
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <M5Stack.h>
#define console Serial
#include <M5Stack.h>
#include <HTTPClient.h> /* Why? see https://qiita.com/ma2shita/items/97bf1a0c3158b848019a */
#define console Serial
#define TEXT_SIZE 2
//https://www.switch-science.com/catalog/5219/
#define ToF_ADDR 0x29 // the iic address of tof
#include <VL53L0X.h> // from Lib. manager: https://github.com/pololu/vl53l0x-arduino/blob/master/examples/Continuous/Continuous.ino
VL53L0X tof;
/* See: https://www.lp.soracom.jp/202005-online-seminar/ */
/*
* TV power monitor (using Light sensor) / with LTE
*
* Copyright (c) 2020 SORACOM, INC.
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <WioLTEforArduino.h>
/* See: https://www.lp.soracom.jp/202005-online-seminar/ */
/*
* TV power monitor (using Light sensor) / Local sensing only version
*
* Copyright (c) 2020 SORACOM, INC.
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
*/
#include <WioLTEforArduino.h>
@ma2shita
ma2shita / m5stack_mqtt_with_soracom_beam_least.ino
Created February 5, 2020 11:54
MQTT Pub/Sub with SORACOM Beam for M5Stack
/* 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>
/*
* Modified to Lib (`Serial` to `Serial1`)
*/
#include <WioLTEforArduino.h>
WioLTE Wio;
#define CONSOLE SerialUSB
#include <RCS620S.h>
RCS620S rcs620s;