This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// WiFi | |
#include <WiFi.h> | |
#include <Ambient.h> | |
WiFiClient client; | |
Ambient ambient; | |
const char *ssid = "your ssid"; | |
const char *password = "your password"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Sound | |
// | |
#include "driver/i2s.h" | |
#include "driver/gpio.h" | |
#include "ching.h" | |
#include "clap.h" | |
#include "cymbal.h" | |
#include "voice.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Sound | |
// | |
#include "driver/i2s.h" | |
#include "driver/gpio.h" | |
#include "ching.h" | |
#include "clap.h" | |
#include "cymbal.h" | |
#include "voice.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Adafruit_NeoPixel.h> | |
#include <TimeLib.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
#define PIN A1 | |
#define Distance A0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ストレートネック矯正デバイス | |
// このコードは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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |