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
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):
[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
#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
build_flags = -Ilib/tfmicro/third_party/gemmlowp -Ilib/tfmicro/third_party/flatbuffers/include
#include "accelerometer_handler.h"
#include "constants.h"
#include <Arduino.h>
#include <M5Stack.h>
#include "utility/MPU9250.h"
MPU9250 IMU;
extern TfLiteStatus SetupAccelerometer(tflite::ErrorReporter* error_reporter);
extern bool ReadAccelerometer(tflite::ErrorReporter* error_reporter,
float* input, int length, bool reset_buffer);
[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
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)
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 "output_handler.h"
#include <Arduino.h>
#include <M5Stack.h>
void DrawWing() {
int x = 60;
int y = 20;
int w = 200;
int h = 200;
int t = 20;