Skip to content

Instantly share code, notes, and snippets.

View arms22's full-sized avatar

arms22

  • Switch Science, Inc.
  • Kyoto, Japan
View GitHub Profile
#include <ThingSpeak.h>
#include <ESP8266WiFi.h>
#include <Adafruit_HDC1000.h>
// 起床間隔
const unsigned long WAKEUP_INTERVAL = 5 * 60 * 1000 * 1000; // 5分
// アップロード閾値
const float TEMPERATURE_TH = 0.5; // 0.5度
const float HUMIDITY_TH = 2.0; // 2.0%
#include <Adafruit_HDC1000.h>
// センサーデータを読み込む間隔(us)
const int WAKEUP_INTERVAL = 15 * 1000 * 1000;
// HDC1000モジュールアクセス用変数
Adafruit_HDC1000 hdc = Adafruit_HDC1000();
// TOUTの代わりにVcc電圧を読めるように設定する
ADC_MODE(ADC_VCC);
# -*- coding: utf-8 -*-
import smbus
class GridEye:
__REG_FPSC = 0x02
__REG_TOOL = 0x0E
__REG_PIXL = 0x80
@arms22
arms22 / read_grid_data.ino
Last active December 28, 2015 06:42
GridEyeサンプル1 - Arduino
#include <Wire.h>
#include <GridEye.h>
GridEye myeye;
void setup(void)
{
// I2Cバスに参加
Wire.begin();
// シリアルポート初期化
@arms22
arms22 / grid_eye_view.ino
Last active January 9, 2019 21:52
GridEyeサンプル2 - Arduino
#include <Wire.h>
#include <GridEye.h>
GridEye myeye;
void setup(void)
{
// I2Cバスに参加
Wire.begin();
// フレームレートを10に設定
@arms22
arms22 / Font.xml
Last active November 13, 2015 09:40 — forked from mzyy94/osmc-jp-font-replace.sh
OSMC Japanese font replace
<?xml version="1.0" encoding="utf-8"?>
<fonts>
<fontset id="Default">
<font>
<name>XLarge</name>
<filename>NotoSans-Regular.ttf</filename>
<linespacing>0.94</linespacing>
<size>48</size>
</font>
<font>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
static double getdiff(const struct timeval &t1, const struct timeval &t2)
{
return (t2.tv_sec - t1.tv_sec) + 1.0 * (t2.tv_usec - t1.tv_usec) / 1000000;
}
@arms22
arms22 / fiber.h
Last active January 2, 2016 08:49
C言語用コルーチン。マイクロスレッドとかファイバーとかそんなやつ。Arduino用に極力シンプルに実装。gccのラベル拡張使ってるからgcc専用。実行結果:fiber test0 0 1 1 1 1 2 2 2 3 3 4 4 5 9
#ifndef FIBER_H
#define FIBER_H
#define FIBER_NEST_ENABLE 1
typedef void* fiber_t;
#define FIBER_INIT { ((void*)0) }
#define FIBER_LINE2(x) FIBER_LINE_ ## x
#define FIBER_LINE(x) FIBER_LINE2(x)
@arms22
arms22 / bin2c.rb
Last active March 23, 2019 00:59
convert binary into c sourcecode
$pat = ARGV
# usage:
# ruby bin2c.rb symbol input > output
sym = $pat[0]
fin = open $pat[1], "rb"
printf "\n\nconst unsigned char %s[] = {\n", sym