Skip to content

Instantly share code, notes, and snippets.

@polymerchm
polymerchm / ui_draw_arrow.py
Created May 23, 2015 21:00
ui_draw_arrow.py
# coding: utf-8
import math
import ui
def getAngle(a,b): # a = start, b = finish
theta = math.atan2(b[1]-a[1], b[0]-a[0])
if theta < 0:
theta -= math.pi/2
elif theta >= 0:
@polymerchm
polymerchm / ui_draw_arrow.py
Created May 24, 2015 11:45
ui_draw_arrow.py
# coding: utf-8
import math
import ui
def getAngle(a,b): # a = start, b = finish
theta = math.atan2(b[1]-a[1], b[0]-a[0])
if theta < 0:
theta -= math.pi/2
elif theta >= 0:
@polymerchm
polymerchm / i2c_restart_main.c
Created December 4, 2024 02:55 — forked from mws-rmain/i2c_restart_main.c
ESP32 I2C example using ESP32 as I2C master, and a I2C device with a registered interface (requires I2C restart to read register value)
/* i2c_restart - Example
For other examples please check:
https://github.com/espressif/esp-idf/tree/master/examples
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
@polymerchm
polymerchm / i2c_restart_main.c
Created December 4, 2024 02:55 — forked from mws-rmain/i2c_restart_main.c
ESP32 I2C example using ESP32 as I2C master, and a I2C device with a registered interface (requires I2C restart to read register value)
/* i2c_restart - Example
For other examples please check:
https://github.com/espressif/esp-idf/tree/master/examples
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.