Skip to content

Instantly share code, notes, and snippets.

View boochow's full-sized avatar
🏠
Working from home

boochow

🏠
Working from home
View GitHub Profile
void loop() {
// Attempt to read new data from the accelerometer
bool got_data = ReadAccelerometer(error_reporter, model_input->data.f,
input_length, should_clear_buffer);
// Don't try to clear the buffer again
should_clear_buffer = false;
// If there was no new data, wait until next time
if (!got_data) return;
// Run inference, and report any error
TfLiteStatus invoke_status = interpreter->Invoke();
#include "accelerometer_handler.h"
#include "constants.h"
#include <Arduino.h>
#include <M5Stack.h>
#include "utility/MPU9250.h"
MPU9250 IMU;
import tensorflow as tf
seq_length = 128
model = tf.keras.Sequential([
tf.keras.layers.Conv2D(
8, (4, 3),
padding="same",
activation="relu",
input_shape=(seq_length, 3, 1)), # output_shape=(batch, 128, 3, 8)
[env:m5stack-fire]
platform = espressif32
board = m5stack-fire
framework = arduino
monitor_speed = 115200
build_flags = -DARDUINOSTL_M_H -Ilib/tfmicro/third_party/gemmlowp -Ilib/tfmicro/third_party/flatbuffers/include
#include<Arduino.h>
#include<math.h>
#include "tensorflow/lite/experimental/micro/kernels/all_ops_resolver.h"
#include "tensorflow/lite/experimental/micro/micro_error_reporter.h"
#include "tensorflow/lite/experimental/micro/micro_interpreter.h"
#include "sine_model_data.h"
#include <M5Stack.h>
#define BLACK 0x0000
#define WHITE 0xFFFF
[env:m5stack-fire]
platform = espressif32
board = m5stack-fire
framework = arduino
board_build.partitions = custom.csv
lib_deps = tfmicro
build_flags = -Ilib/tfmicro/third_party/gemmlowp -Ilib/tfmicro/third_party/flatbuffers/include
import sensor, lcd, image
sensor.reset()
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.RGB565)
sensor.set_hmirror(False)
lcd.init(freq=15000000)
face_cascade = image.HaarCascade("frontalface", stages=25)
while (True):
import sensor, lcd, image
import time
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_hmirror(0)
sensor.run(1)
sensor.skip_frames()
lcd.init(freq=15000000)
from Maix import GPIO
fm.register(32, fm.fpioa.GPIO1)
sp_en=GPIO(GPIO.GPIO1,GPIO.OUT)
sp_en.value(1)
WIFI_SSID = "ssid"
WIFI_PASSWD = "password"
import network, time
print("=== Configuring FPIOA")
from fpioa_manager import fm, board_info
from Maix import GPIO
from machine import UART