Skip to content

Instantly share code, notes, and snippets.

View TareObjects's full-sized avatar

Koichi Kurahashi TareObjects

View GitHub Profile
const int kRed = 12;
const int kGreen = 14;
const int kBlue = 15;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Init");
const int kRed = 12;
const int kGreen = 14;
const int kBlue = 15;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Init");
// ESP_IR_Remote_Receive_Dump by koichi kurahashi 2016/09/22
//
//
// This source code is from below sample code. Thanks.
//
// IRremoteESP8266: IRrecvDump - dump details of IR codes with IRrecv
// An IR detector/demodulator must be connected to the input RECV_PIN.
// Version 0.1 Sept, 2015
// Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
// ESP_IR_Remote_Send_Demo by 2016/09/22 koichi kurahashi
//
//
// This source code is from below sample code. Thanks.
// IRremoteESP8266: IRsendGCDemo - demonstrates sending Global Cache-formatted IR codes with IRsend
// An IR LED must be connected to ESP8266 pin 0.
// Version 0.1 30 March, 2016
// Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
#include <IRremoteESP8266.h>
// DRV8830 control over http / ESP-WROOM-02
//
// Thanks :
// HelloServer : a Sample program for ESP8266
//
const int LED = 13;
const int kMaxSpeed = 0x3f;
// DRV8830 test / ESP-WROOM-02
//
// DRV8830で直流モータをDriveするテスト。速度を正弦波に乗せてゆっくり加減速と反転を繰り返す
//
// Thanks :
// 「Arduino Nano とモータードライバでDCモーターを正転・逆転してみた(1) [Arduino]」
// http://makers-with-myson.blog.so-net.ne.jp/2014-05-15
//
//
// Sleep log by PIR by Koichi Kurahashi 2016-08-13
//
//
// WiFi
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include "../../private_ssid.h"
//const char *ssid = "*************";
//const char *pass = "*************";
const unsinged char kModeIdle = 1;
const unsigned char kModePlayingOn = 2;
const unsigned char kModePlayingOff = 3;
unsinged char mode = kModeIdle;
const unsigned char kModePowerOff = 0;
#include <Wire.h>
#include <Time.h>
volatile byte b = 0;
const int kPower = P2_5; // mosfet switch
const int kModeWaiting = 1;
//
// Storageを読み込む。もしCRCが不一致なら初期化
//
bool readStorageAndInitIfNeeded() {
bool ok = system_rtc_mem_read(kOffset_CRC, &storage, sizeof(storage));
if (!ok) {
Serial.println("readStorageAndInitIfNeeded : mem_read fail");
return ok;
}