added odyssey env; declare and init MMC5603

This commit is contained in:
2023-12-19 21:20:55 +00:00
parent 8b5f736cdb
commit e840da2134
2 changed files with 55 additions and 4 deletions

View File

@@ -12,10 +12,33 @@
platform = espressif32
board = esp32cam
framework = arduino
lib_deps =
lib_deps =
https://github.com/me-no-dev/ESPAsyncWebServer.git
me-no-dev/AsyncTCP@^1.1.1
ayushsharma82/AsyncElegantOTA@^2.2.7
arduino-libraries/Arduino_JSON@^0.1.0
adafruit/Adafruit MMC56x3@^1.0.1
ayushsharma82/ElegantOTA@^3.1.0
board_build.partitions = partitions.csv
monitor_speed = 115200
monitor_speed = 115200
[env:odyssey]
platform = espressif32
board = seeed_xiao_esp32s3
framework = arduino
platform_packages = toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
lib_deps =
me-no-dev/AsyncTCP@^1.1.1
https://github.com/me-no-dev/ESPAsyncWebServer.git
https://github.com/chopster44/Adafruit_Sensor.git
https://github.com/chopster44/Adafruit_BME280_Library.git
https://github.com/adafruit/Adafruit_BusIO.git
https://github.com/chopster44/Adafruit_MMC56x3.git
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit MMC56x3@^1.0.1
ayushsharma82/AsyncElegantOTA@^2.2.7
build_flags =
'-D ARDUINO_USB_MODE=0'
'-D ARDUINO_USB_CDC_ON_BOOT=1'
'-D ELEGANTOTA_USE_ASYNC_WEBSERVER=1'
monitor_speed = 115200

View File

@@ -15,12 +15,19 @@
#include <ESPAsyncWebServer.h>
#include <SPIFFSEditor.h>
#include <Arduino_JSON.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_MMC56x3.h>
#include <Preferences.h>
Preferences settings;
#define LED_PIN 2
/* Assign a unique ID to this sensor at the same time */
Adafruit_MMC5603 mag = Adafruit_MMC5603(12345);
//*********************************************************
// Web server variable declarations
//*********************************************************
@@ -66,10 +73,31 @@ String getLEDState();
// ----------------------------------------------
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
Serial.begin(115200);
delay(2000);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
if (!Wire.begin(4,5)) {
while(1){
Serial.println("WIRE NOT INIT");
delay(500);
}
}
Serial.println("Adafruit_MMC5603 Magnetometer Calibration");
Serial.println("");
/* Initialise the sensor */
if (!mag.begin(MMC56X3_DEFAULT_ADDRESS, &Wire)) { // I2C mode
/* There was a problem detecting the MMC5603 ... check your connections */
Serial.println("Ooops, no MMC5603 detected ... Check your wiring!");
while (1) delay(10);
}
//*****************************************
//Init OTA
AsyncElegantOTA.begin(&server); // Start AsyncElegantOTA