Skip to content

Instantly share code, notes, and snippets.

@astropika
astropika / main.py
Last active August 26, 2024 16:40
Micropython TMC2130 control script for a simple variable speed turntable, used on an ESP32. Docs for registry values at https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf
import machine
from machine import Pin, SPI, PWM, ADC
import time
import struct
import sys
# for use with TMC2130
led = Pin(13, Pin.OUT)
enable = Pin(32, Pin.OUT)
#!/usr/bin/env python3
import glob
import os
import requests
from io import BytesIO
from flask import Flask, send_file, request, Response, stream_with_context
from flask_restful import Resource, Api
from flask.ext.cors import CORS
from pydub import AudioSegment
from socket import *
import time
import os,sys
cport=40002
red=bytes('\xFF\x00\x00')
blue=bytes('\x00\xFF\x00')
green=bytes('\x00\x00\xFF')
black=bytes('\x00\x00\x00')