Skip to content

Instantly share code, notes, and snippets.

View ShawnHymel's full-sized avatar

Shawn Hymel ShawnHymel

View GitHub Profile
@ShawnHymel
ShawnHymel / BatteryBabysitter_Demo.ino
Last active April 20, 2023 15:13
Battery Babysitter Demo
/**
* Battery Babysitter Demo
* June 22, 2016
*
* RGB LED changes colors based on LiPo state of charge
*
* Hardware:
* Babysitter | LED (Common Anode) | Arduino
* -------------|---------------------|---------
* GND | | GND
@ShawnHymel
ShawnHymel / arduino_msa301_daq.ino
Created February 25, 2020 23:09
Low Cost Arduino DAQ Example
#include <Wire.h>
#include <Adafruit_MSA301.h>
#include <Adafruit_Sensor.h>
Adafruit_MSA301 msa;
void setup() {
// Open serial port
Serial.begin(250000);
@ShawnHymel
ShawnHymel / gym-recorder-demo.py
Last active December 11, 2022 22:44
OpenAI Gym Video Recorder
# This works for gym 0.26.2. It might not work on previous versions.
import gym
import cv2
fps = 30
# Create environment
env = gym.make('CartPole-v1', render_mode='rgb_array')
@ShawnHymel
ShawnHymel / one_channel_receiver.ino
Created August 17, 2017 16:15
One Channel RC Hobby Receiver
/**
* One Channel Receiver
* Author: Shawn Hymel (SparkFun Electronics)
* Date: Aug 17, 2017
*
* Connect a TB6612FNG and RC (PWM) receiver to the Arduino.
* Only works 1 channel for forward and back drive.
*
* This code is beerware; if you see me (or any other SparkFun
* employee) at the local, and you've found our code helpful,
@ShawnHymel
ShawnHymel / pygame-display-test.py
Created September 21, 2022 21:22
PyGame Display Test
"""
PyGame Display Test
Run to see if you can draw things in Pygame. Press 'esc` to exit. Run with
root privileges to draw on external monitor (e.g. from SSH).
"""
import pygame
# Initialize pygame
@ShawnHymel
ShawnHymel / printf_test.ino
Created August 28, 2022 18:02
Arduino printf test
#include <stdarg.h>
// Makeshift printf for the Serial terminal
void aprintf(const char *format, ...) {
static char print_buf[1024] = { 0 };
va_list args;
va_start(args, format);
int r = vsnprintf(print_buf, sizeof(print_buf), format, args);
va_end(args);
@ShawnHymel
ShawnHymel / Save_Reminder.ino
Last active June 3, 2022 03:33
Save early. Save often.
/**
* Save Reminder
* Date: February 1, 2018
* Author: Shawn Hymel (SparkFun Electronics)
*
* Connect to an open USB port on your computer. Every 5 minutes,
* the LED will begin flashing. Press the button to send a ctl+s
* or cmd+s key press to your computer to save your work.
*
* Pick your operating system by updating the OS variable.
@ShawnHymel
ShawnHymel / gps_raw.ino
Created July 26, 2017 22:36
GPS Raw NMEA
#include <SoftwareSerial.h>
SoftwareSerial soft(10, 11); // Rx, Tx
void setup() {
Serial.begin(9600);
soft.begin(9600);
}
void loop() {
@ShawnHymel
ShawnHymel / eye_test_01.py
Last active December 30, 2021 18:46
Adafruit HT16K33 LED matrix backpack test for Raspberry Pi
import board
import busio
import time
from random import random
from adafruit_ht16k33 import matrix
# Initialize LED matrix
i2c = busio.I2C(board.SCL, board.SDA)
eye =matrix.Matrix8x8(i2c)
@ShawnHymel
ShawnHymel / cnn-live-inference-lcd.py
Created September 26, 2021 19:33
OpenMV Electronic Component CNN Live Classification with LCD
"""
OpenMV Live Image Inference
Continuously captures images and performs image using provided TFLite model
file. Outputs probabilities in console. Displays preview on LCD backpack along
with predicted label.
Author: EdgeImpulse, Inc.
Modified: Shawn Hymel
Date: September 26, 2021