Skip to content

Instantly share code, notes, and snippets.

# ble_tof
import struct
from machine import I2C, SoftI2C, Pin, Timer
from vl53l0x import VL53L0X
import m5stickc
import m5stickc_lcd
<html>
<head>
<title>BLE IMU Receiver</title>
</head>
<body style="font-family:'Inconsolata', sans-serif;">
<div style="text-align: center;">
<h1>BLE IMU Receiver</h1>
@standarddeviant
standarddeviant / README.md
Created March 6, 2021 17:53
Polynomial Long Division

Polynomial Division Pseudo-Code

The below steps assume that there's some polynomial type (could just be a length-N list) and support functions that are aware of that type.

Necessary support functions

  • order(p1) - returns the order of polynomial p1
  • highest(p1) - highest order coefficient of p1
  • add(p1, p2) - adds two polynomials
  • sub(p1, p2) - subtracts two polynomials
@standarddeviant
standarddeviant / frac_delay.ipynb
Last active January 23, 2025 06:17
simple fractional delay in Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@standarddeviant
standarddeviant / wake_on_motion_from_deep_sleep.ino
Created July 6, 2020 03:38
M5StickC wake-on-motion MPU6886 interrupt IMU motion MPU
#include <Arduino.h>
#include <M5StickC.h>
#include <utility/MPU6886.h> // used for accessing MPU constants
#include <driver/rtc_io.h>
void mpu6886_wake_on_motion_isr(void); // declaration of ISR
void mpu6886_wake_on_motion_setup(void); // declaration of setup
// lifted from https://github.com/m5stack/M5StickC/blob/master/src/utility/MPU6886.cpp
// if integrated with M5StickC library, use internal class function instead
#include <Arduino.h>
#include <M5StickC.h>
#include <utility/MPU6886.h> // used for accessing MPU constants
void mpu6886_wake_on_motion_isr(void); // declaration of ISR
void mpu6886_wake_on_motion_setup(void); // declaration of setup
// lifted from https://github.com/m5stack/M5StickC/blob/master/src/utility/MPU6886.cpp
// if integrated with M5StickC library, use internal class function instead
void MPU6886_I2C_Read_NBytes(uint8_t start_Addr, uint8_t number_Bytes, uint8_t *read_Buffer){
import socket
import sys
msgFromClient = "Hello UDP Server"
if len(sys.argv) >= 2:
msgFromClient = sys.argv[1]
bytesToSend = str.encode(msgFromClient)
serverAddressPort = ("192.168.0.174", 3333)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>
</head>
import io
import numpy as np
from numpy.random import randint, standard_normal
dtypes = ('float32', 'float64', 'int64', 'int32', 'int16')
def make_random_array():
s = randint(1, 5, size=randint(1, 5))
d = dtypes[randint(0, len(dtypes))]