Skip to content

Instantly share code, notes, and snippets.

View TareObjects's full-sized avatar

Koichi Kurahashi TareObjects

View GitHub Profile
//
// WiFi
#include <WiFi.h>
#include <Ambient.h>
WiFiClient client;
Ambient ambient;
const char *ssid = "your ssid";
const char *password = "your password";
//
// Sound
//
#include "driver/i2s.h"
#include "driver/gpio.h"
#include "ching.h"
#include "clap.h"
#include "cymbal.h"
#include "voice.h"
//
// Sound
//
#include "driver/i2s.h"
#include "driver/gpio.h"
#include "ching.h"
#include "clap.h"
#include "cymbal.h"
#include "voice.h"
#define servoPin 12
#define servoCh 0
#define servoBits 15
#define servoMax 32767
void degreeToLED(float inDegree) {
float msec = inDegree / 90.0 * 0.5 + 1.5;
int duty = msec / 20.0 * (float)servoMax;
Serial.println(duty);
#define servoPin 12
void setup() {
Serial.begin(115200);
pinMode(servoPin, OUTPUT);
}
void loop() {
for (float pos = -90; pos <= 90; pos += 0.1) {
float msec = pos / 90.0 * 0.5 + 1.5;
#include <Adafruit_NeoPixel.h>
#include <TimeLib.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN A1
#define Distance A0
// ストレートネック矯正デバイス
// このコードはivc氏のデモコードを元にしています。ありがとうございます。
// This program is based on a demo code below. Thanks, ivc!
// http://beta.ivc.no/wiki/index.php/ATtiny85_8MHz_and_ADXL345_via_I2C_with_Arduino_code
/* ATtiny85 and ADXL345 demo code
by ivc <ivc at x-pec.com> 2015
This sensor test will enable the red LED on the Trinket board when the y-axis is positive, e.g. tilted to one side, and turn
off when tilted the other way.
#include <Servo.h>
const int PinServo = 9;
const int PinPIR = 8;
const int PinCamera = 7;
const int CameraOn = LOW;
const int CameraOff = HIGH;
Servo servo;
i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX
.sample_rate = SAMPLE_RATE,
.bits_per_sample = BITS_PER_SAMPLE,
//.channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, //2-channels
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB,
.dma_buf_count = 16 ,
.dma_buf_len = 64, //
.intr_alloc_flags = ESP_INTR_FLAG_LEVEL1 //Interrupt level 1
#include "voice.h" // 16khz, 16bit, wav data block
// add 0x8000 to each original wave format data
void setup()
{
Serial.begin(115200);
Serial.println("start");
sigmaDeltaSetup(0, 16000);
sigmaDeltaSetup(1, 16000);