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 "driver/ledc.h" | |
static void enable_out_clock(uint8_t pin,double freq) { | |
periph_module_enable(PERIPH_LEDC_MODULE); | |
ledc_timer_bit_t bit_num = (ledc_timer_bit_t) 1; // 3 normally | |
int duty = pow(2, (int) bit_num) / 2; | |
ledc_timer_config_t timer_conf; | |
timer_conf.bit_num = bit_num; | |
timer_conf.freq_hz = freq; |
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 <Wire.h> | |
#define M5GO_WHEEL_ADDR 0x56 | |
#define MOTOR_CTRL_ADDR 0x00 | |
#define ENCODER_ADDR 0x04 | |
#define DEAD_ZONE 5 | |
void setMotor(int16_t pwm0, int16_t pwm1) { | |
Wire.beginTransmission(M5GO_WHEEL_ADDR); | |
Wire.write(MOTOR_CTRL_ADDR); // Motor ctrl reg addr |
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 <Wire.h> | |
void setup() { | |
// put your setup code here, to run once: | |
Wire.begin( 21, 22, 400000 ); | |
Wire.beginTransmission( 0X1A ); | |
uint8_t error = Wire.endTransmission(); | |
if ( error ) ESP_LOGI( TAG, "No codec found." ); | |
} |
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 <Arduino.h> | |
#ifdef ESP32 | |
#include <WiFi.h> | |
#else | |
#include <ESP8266WiFi.h> | |
#endif | |
#include "AudioFileSourceICYStream.h" | |
#include "AudioFileSourceBuffer.h" | |
#include "AudioGeneratorMP3a.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
//AudioOutPutI2S.cpp is aangepast | |
//Works on a M5Stack Fire with PSRAM enabled - compiled for esp32 dev kit - 16MB flash - 4MB PSRAM | |
#include <WiFi.h> | |
//#include <TFT_eSPI.h> | |
#include "AudioFileSourceICYStream.h" | |
#include "AudioFileSourceBuffer.h" | |
#include "AudioGeneratorMP3a.h" | |
#include "AudioOutputI2S.h" | |
#define BUTTON_A 39 |
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
#pragma mark - Depend ESP8266Audio and ESP8266_Spiram libraries | |
/* | |
cd ~/Arduino/libraries | |
git clone https://github.com/earlephilhower/ESP8266Audio | |
git clone https://github.com/Gianbacchio/ESP8266_Spiram | |
Use the "Tools->ESP32 Sketch Data Upload" menu to write the MP3 to SPIFFS | |
Then upload the sketch normally. | |
https://github.com/me-no-dev/arduino-esp32fs-plugin | |
*/ |
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
/** | |
* MPU9250 Basic Example Code for Dual MPU9250 | |
* Copyright (c) 2014 Kris Winer | |
* Copyright (c) 2018 botamochi6277 | |
* license: Beerware - Use this code however you'd like. If you | |
* find it useful you can buy me a beer some time. | |
*/ | |
#include <M5Stack.h> | |
#include "utility/MPU9250.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
// Attach this header file to your sketch to use the GFX Free Fonts. You can write | |
// sketches without it, but it makes referencing them easier. | |
// This calls up ALL the fonts but they only get loaded if you actually | |
// use them in your sketch. | |
// | |
// No changes are needed to this header file unless new fonts are added to the | |
// library "Fonts/GFXFF" folder. | |
// | |
// To save a lot of typing long names, each font can easily be referenced in the |
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
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html | |
/* this example has to be compiled with PSRAM enabled. */ | |
#include <M5Stack.h> | |
#include <driver/adc.h> | |
#define MICROPHONE 34 | |
#define SPEAKER 25 | |
#define BACKLIGHT 32 | |
#define BUFFER_SIZE 1000*1000 |
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 "arduinoFFT.h" | |
//#include <M5Stack.h> | |
//#include <esp_wifi.h> | |
#include <TFT_eSPI.h> | |
//#include <M5Display.h> // This library is a lot faster! But also a lot larger. | |
#define microphone 34 | |
#define speaker 25 | |
#define backlight 32 |