Skip to content

Instantly share code, notes, and snippets.

View ricklon's full-sized avatar

Rick Anderson ricklon

View GitHub Profile
@ricklon
ricklon / keypadtouch.ino
Created April 11, 2024 20:21
Working t-display-s3 touch code
#include <Arduino.h>
#include <TFT_eSPI.h>
#include <Wire.h>
#define TOUCH_MODULES_CST_SELF
#include <TouchLib.h>
#define PIN_IIC_SDA 18
#define PIN_IIC_SCL 17
#define PIN_TOUCH_RES 16
#define PIN_POWER_ON 15
@ricklon
ricklon / as5047p_spi
Created October 14, 2018 22:00
as5047p read angle
/*
AS5047D AMS magnetic position sensor demonstration sketch
Hardware is : Fubarino Mini, default SPI port, AS5047D in 3.3V power mode
*/
#include <SPI.h>
/* Each possible address in the chip */
@ricklon
ricklon / BlinkInOrderTimeOne.ino
Created September 22, 2022 16:53
TimeOne Example
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
@ricklon
ricklon / show.py
Created March 25, 2017 23:47
Show image from array in npz file
import matplotlib.pyplot as plt
import numpy as np
dfile = "imgs_2017-03-25_18:40:42.npz"
images = np.load(dfile)["arr_0"]
images.shape
plt.ion()
plt.figure()
plt.imshow(images[0].transpose((1,2,0)))
#quick rough out of multi camera image capture
import cv2
import numpy as np
from datetime import datetime
import time
import argparse
# construct the argument parser and parse the arguments
@ricklon
ricklon / mechanicalkeyboard.txt
Created February 22, 2021 14:43
How to Mechanical Keyboard
Keyboard layout
https://config.qmk.fm/#/clueboard/2x1800/2019/LAYOUT
Keyboard Visual Layout
http://www.keyboard-layout-editor.com/#/
Hand Wired Keyboards
https://medium.com/cracked-the-code/a-complete-guide-to-building-a-hand-wired-keyboard-9d8c9cc7b041
PCB for keyboards
@ricklon
ricklon / notes.md
Created February 4, 2021 00:39
Unity 2D sprite combat

What I've learned so far:

  • you need to define what the "robot" or "player" can do. left, right, jump, crouch vs up,dow,left,right.attack, spinup. spindown, flameon, flameoff
  • Then separate activities into "controller" and "movement"
  • I think this is helpful in case NPCs or opponets need to be able to fight.
  • Then it's critical to use "layers" but not the "sortable" layers. For barries, ground, robots, hazards
  • I think the animations and sprite layers should be sortable layers based on default.
  • But that's a guess.
# import the opencv library
import cv2
import numpy as np
import matplotlib
from matplotlib import colors
from matplotlib import pyplot as plt
print(cv2.__version__)
vid = cv2.VideoCapture(1)
# https://www.codingforentrepreneurs.com/blog/opencv-python-web-camera-quick-test/
# https://stackoverflow.com/questions/41406547/how-to-detect-a-full-black-color-image-in-opencv-python
# Getting a USB error,
import numpy as np
import cv2
font = cv2.FONT_HERSHEY_SIMPLEX
NUM_CAMS = 2

Headless PI Files

In /boot

  1. add "ssh" or "ssh.txt" file
  2. add wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>