This file contains 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 <M5StickC.h> | |
#include <Wire.h> | |
#include "Adafruit_Sensor.h" | |
#include <Adafruit_BMP280.h> | |
#include "SHT3X.h" | |
#include "Ambient.h" | |
SHT3X sht30; | |
Adafruit_BMP280 bme; | |
WiFiClient client; |
This file contains 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
/* | |
* TFMini-SとM5StickCで距離を測る | |
*/ | |
#include <M5StickC.h> | |
#define TFMINI_FRAME_SIZE 7 | |
int getTFminiData(Stream* streamPtr, int* distance, int* strength) { | |
uint8_t lastChar = 0x00; | |
uint8_t frame[TFMINI_FRAME_SIZE]; |
This file contains 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 <M5StickC.h> | |
void setup() { | |
M5.begin(); | |
M5.Lcd.setTextSize(2); | |
pinMode(33, INPUT_PULLUP); | |
} | |
void loop() { |
This file contains 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 <M5StickC.h> | |
#include <WiFi.h> | |
#include "Ambient.h" | |
const char* ssid = "ssid"; // この場所のSSID(2.4GHzの) | |
const char* password = "password"; // SSIDに対応するパスワード | |
const char* userKey = "ユーザーキー"; | |
char devKey[20]; | |
unsigned int channelId; |
This file contains 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 <M5StickC.h> | |
#include <WiFi.h> | |
#include <Ambient.h> | |
#define PIR 36 | |
const char* ssid = "ssid"; // この場所のSSID(2.4GHzの) | |
const char* password = "password"; // SSIDに対応するパスワード | |
unsigned int channelId = 100; |
This file contains 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 <M5StickC.h> | |
#include "arduinoFFT.h" | |
#define SAMPLE_PERIOD 5 // サンプリング間隔(ミリ秒) | |
const uint16_t FFTsamples = 64; //This value MUST ALWAYS be a power of 2 | |
double vReal[FFTsamples]; | |
double vImag[FFTsamples]; | |
const double samplingFrequency = 1000.0 / (double)SAMPLE_PERIOD; // 200Hz | |
arduinoFFT FFT = arduinoFFT(vReal, vImag, FFTsamples, samplingFrequency); // FFTオブジェクトを作る |
This file contains 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 "arduinoFFT.h" | |
arduinoFFT FFT = arduinoFFT(vReal, vImag, FFTsamples, samplingFrequency); // FFTオブジェクトを作る | |
for (int i = 0; i < FFTsamples; i++) { // 振動をサンプリングする | |
float ax, ay, az; // 加速度データを読み出す変数 | |
long t = micros(); | |
M5.MPU6886.getAccelData(&ax,&ay,&az); // MPU6886から加速度を取得 | |
vReal[i] = az * 1000; // mGに変換 | |
vImag[i] = 0; |
This file contains 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 <M5StickC.h> | |
#define SAMPLE_PERIOD 20 // サンプリング間隔(ミリ秒) | |
#define SAMPLE_SIZE 150 // 20ms x 150 = 3秒 | |
void setup() { | |
M5.begin(); | |
M5.Lcd.setRotation(3); | |
M5.MPU6886.Init(); // MPU6886を初期設定する | |
} |
This file contains 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
/* | |
* ESP32でSi7021を読み、Ambientに送り、DeepSleepする | |
*/ | |
#ifdef ARDUINO_M5Stack_Core_ESP32 | |
#include <M5Stack.h> | |
#endif | |
#include <WiFi.h> | |
#include "Adafruit_Si7021.h" | |
#include <Ambient.h> |
This file contains 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
/* | |
* PAC1710で10ミリ秒毎に1000回、10秒、電流値を測定し、SDカードに書く | |
*/ | |
#include <M5Stack.h> | |
#include <Wire.h> | |
#include "PAC1710.hpp" | |
#include "menu.h" | |
void beep(int freq, int duration, uint8_t volume); |