Skip to content

Instantly share code, notes, and snippets.

View bitbank2's full-sized avatar
💭
writing new Arduino libraries

Larry Bank bitbank2

💭
writing new Arduino libraries
View GitHub Profile
@bitbank2
bitbank2 / optimization_lesson.ino
Created April 3, 2025 14:29
The code to accompany a lesson C optimization
//
// Simple optimization example - performance measurement
//
// Simulate drawing a 16x16 character block
uint8_t bitmap_out_tmp[16*16];
uint8_t bitmap_in[16*8];
static const uint8_t opa4_table[16] = {0, 17, 34, 51,
68, 85, 102, 119,
136, 153, 170, 187,
//
// Updated camera demo for the CoreS3
// written by Larry Bank
//
// The GC0308 640x480 camera only supports
// uncompressed output (not JPEG). To create
// JPEG images (e.g. for transmission over WiFi)
// We must use a software JPEG encoder. The
// JPEG codec supplied by Espressif:
// https://github.com/espressif/esp32-camera/blob/master/conversions/to_jpg.cpp
@bitbank2
bitbank2 / gzip_power_test.ino
Created July 12, 2024 11:26
Arduino sketch to test power savings of gzip on esp32 HTTP GET requests
//
// gzip power test
// written by Larry Bank ([email protected])
// July 9, 2024
//
// This sketch uses my zlib_turbo to compare how much power
// is used by a gzip payload vs uncompressed on the Unexpected Maker FeatherS2
//
#include <WiFi.h>
#include <HTTPClient.h>
@bitbank2
bitbank2 / Arduino.c
Created May 18, 2023 13:08
Example of bit banging on CH32V
/*
* Arduino.c
*
* Created on: Jan 12, 2023
* Author: larry
*/
#include "debug.h"
#include <stdint.h>
#include "Arduino.h"
@bitbank2
bitbank2 / interactive_spi.ino
Created March 25, 2023 08:18
An interactive serial terminal program to control GPIO, SPI, etc on a USB-connected Microcontroller
//
// Interactive SPI & GPIO tester
// written by Larry Bank
// August 14, 2022
//
// Purpose: Use the serial terminal to interactively test SPI & GPIO devices on ESP32 MCUs
//
// Copyright 2022 BitBank Software, Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@bitbank2
bitbank2 / person_sensor.h
Created November 10, 2022 12:53
Person Sensor test sketch for Arduino (FeatherS3 w/OLED display)
#ifndef INCLUDE_PERSON_SENSOR_H
#define INCLUDE_PERSON_SENSOR_H
// Definitions for the Useful Sensors Person Sensor module.
// Includes the standard I2C address of the sensor, constants for the
// configuration commands, and the data structures used to communicate results
// to the main system.
// See the full developer guide at https://usfl.ink/ps_dev for more information.
#include <stdint.h>
@bitbank2
bitbank2 / gps_test.ino
Created August 20, 2022 13:39
Simplest possible program to capture GPS current time and location (no external dependencies for parsing NMEA strings)
//
// GP-02 GPS/BDS/GNSS module performance test
// tested with a ESP32-S2 module (USB CDC serial + exposed HW UART pins)
//
#include <OneBitDisplay.h>
ONE_BIT_DISPLAY obd;
uint8_t u8Flags;
#define FLAG_TIMEDATE 1
#define FLAG_POSITION 2
@bitbank2
bitbank2 / Roboto_Black_20.h
Created August 18, 2022 11:18
ESP32-S2 (FeatherS2) e-ink weather station
// Created by http://oleddisplay.squix.ch/ Consider a donation
// In case of problems make sure that you are using the font file with the correct version!
const uint8_t Roboto_Black_20Bitmaps[] PROGMEM = {
// Bitmap Data:
0x00, // ' '
0xF7,0xBD,0xEF,0x39,0xCC,0x63,0x00,0xCF,0x30, // '!'
0xCD,0x9B,0x36,0x6C,0xD9,0x00, // '"'
0x0C,0xC0,0xCC,0x0D,0x80,0xD8,0x7F,0xE7,0xFE,0x19,0x81,0x90,0xFF,0xEF,0xFE,0x13,0x03,0x30,0x33,0x03,0x70, // '#'
0x04,0x00,0x80,0x7C,0x3F,0xC7,0xFC,0xE7,0x9C,0x03,0xE0,0x3F,0x03,0xF0,0x0F,0x70,0xEF,0x3D,0xFF,0x9F,0xE0,0xF8,0x0C,0x01,0x80, // '$'
// Created by http://oleddisplay.squix.ch/ Consider a donation
// In case of problems make sure that you are using the font file with the correct version!
const uint8_t Roboto_Black_28Bitmaps[] PROGMEM = {
// Bitmap Data:
0x00, // ' '
0xFB,0xEF,0x3C,0xF3,0xCF,0x3C,0xF3,0xCF,0x3C,0xF0,0x00,0x3C,0xF3,0xEF,0x3C, // '!'
0xF7,0x7B,0xB9,0xDC,0xEE,0x77,0x3B,0x9D,0xCE, // '"'
0x03,0x18,0x03,0x9C,0x01,0xCE,0x00,0xE7,0x00,0x73,0x80,0x39,0x81,0xFF,0xFC,0xFF,0xFE,0x7F,0xFF,0x07,0x38,0x03,0x9C,0x01,0xCC,0x0F,0xFF,0xE7,0xFF,0xF3,0xFF,0xF8,0x39,0xC0,0x1C,0xE0,0x0E,0x70,0x06,0x30,0x07,0x38,0x00, // '#'
0x03,0x80,0x07,0x00,0x0E,0x00,0x7E,0x01,0xFF,0x07,0xFF,0x1F,0xFE,0x3E,0x3E,0x78,0x7C,0xF8,0x01,0xF8,0x01,0xFC,0x01,0xFE,0x01,0xFE,0x00,0xFE,0x00,0x7E,0xF8,0x7D,0xF0,0xFB,0xF1,0xF3,0xFF,0xE7,0xFF,0x87,0xFE,0x03,0xF8,0x01,0x80,0x03,0x00,0x06,0x00, // '$'
@bitbank2
bitbank2 / scd41_01space.ino
Created May 12, 2022 16:47
SCD41 CO2 sensor demo running on 01Space's ESP32-C3 0.42" OLED board
//
// SCD4x example
// Customized for the 01Space ESP32-C3 0.42" OLED board
// written by Larry Bank
//
// Displays the SCD41 CO2 sensor values on the built-in 72x40 OLED
//
#include <Wire.h>
#include <OneBitDisplay.h>
#include "SparkFun_SCD4x_Arduino_Library.h" //Click here to get the library: http://librarymanager/All#SparkFun_SCD4x