Skip to content

Instantly share code, notes, and snippets.

@haru01
haru01 / rotary2lcdRGB.ino
Last active August 11, 2016 08:35
回転角センサーでカラー表示を変更
#include "rgb_lcd.h"
#define ROTARY_ANGLE_SENSOR A0
#define ADC_REF 5//reference voltage of ADC is 5v.If the Vcc switch on the seeeduino
//board switches to 3V3, the ADC_REF should be 3.3
#define GROVE_VCC 5//VCC of the grove interface is normally 5v
#define FULL_ANGLE 300//full value of the rotary angle is 300 degrees
rgb_lcd lcd;
@haru01
haru01 / picopicopii.ino
Created August 22, 2016 12:35
ピコピコぴー
#include <Tone.h>
#include "Ultrasonic.h"
Tone notePlayer;
Ultrasonic ultrasonic(7);
void setup(void)
{
notePlayer.begin(8);
}
@haru01
haru01 / touchtone.ino
Created September 3, 2016 22:05
タッチで音
#include <stdint.h>
#include <SeeedTouchScreen.h>
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A1 // must be an analog pin, use "An" notation!
#define YM 14 // can be a digital pin, this is A0
#define XP 17 // can be a digital pin, this is A3
#define TS_MINX 116*2
#define TS_MAXX 890*2
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <PubSubClient.h>
const char* ssid = "****";
const char* wifi_password = "****";
const char* mqtt_server = "****";
const int port = ****;
const char* username = "****";
const char* password = "****";
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <PubSubClient.h>
const char* ssid = "****";
const char* wifi_password = "****";
const char* mqtt_server = "****";
const int port = ****;
const char* username = "****";
@haru01
haru01 / shake.ino
Last active November 27, 2016 02:08
#include <Wire.h>
#include <SPI.h>
#include <SparkFunLSM9DS1.h>
LSM9DS1 imu;
#define LSM9DS1_M 0x1E // Would be 0x1C if SDO_M is LOW
#define LSM9DS1_AG 0x6B // Would be 0x6A if SDO_AG is LOW
#define PRINT_SPEED 250 // 250 ms between prints
#include <ESP8266WiFi.h>
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
@haru01
haru01 / gist:9d885eacae730132d7ee96af7e0bba28
Last active April 26, 2017 13:57
vcodeの ソースコード読みようにちょっと調整
[
{
"key": "cmd+down",
"command": "editor.action.goToDeclaration",
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor"
},
{
"key": "cmd+up",
"command": "workbench.action.navigateBack"
},
@haru01
haru01 / roman_test.go
Last active May 28, 2017 10:25
step1
package roman
import (
"testing"
)
func TestToRoman(t *testing.T) {
got := ToRoman(1)
if got != "I" {
t.Errorf("Fail ToRoman(1): want I got %s", got)
package roman
func ToRoman(i int) string {
return "_"
}