Skip to content

Instantly share code, notes, and snippets.

View futureshocked's full-sized avatar

Peter Dalmaris futureshocked

View GitHub Profile
@futureshocked
futureshocked / SH1106_128x64_i2c_QTPY.ino
Created February 26, 2025 03:02
I2C header tested using a SH1106 128x64 OLED for techexplorations.com/blog/course/advanced-pcb-design-kicad
/*********************************************************************
This is an example for our Monochrome OLEDs based on SH110X drivers
This example is for a 128x64 size display using I2C to communicate
3 pins are required to interface (2 I2C and one reset)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@futureshocked
futureshocked / sd_card_v1.ino
Created February 26, 2025 03:01
SD card module tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <SPI.h>
#include <SD.h>
#define SD_CS_PIN 0 // Chip Select (CS) pin for SD card (GPIO0)
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / photosensor_v1.ino
Created February 26, 2025 03:00
Photosensor tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#define TEMT6000_PIN 1 // GPIO pin connected to the TEMT6000X01 sensor
void setup() {
// Start the serial communication
Serial.begin(115200);
while (!Serial);
// Configure the analog pin
pinMode(TEMT6000_PIN, INPUT);
}
@futureshocked
futureshocked / microphone.ino
Created February 26, 2025 02:59
Audio sensor tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#define MIC_PIN 5 // GPIO 5 is connected to the microphone
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
// Configure GPIO 5 as input for the microphone signal
pinMode(MIC_PIN, INPUT);
}
@futureshocked
futureshocked / LED_blink.ino
Created February 26, 2025 02:58
LED tester for the exposed GPIOs for techexplorations.com/blog/course/advanced-pcb-design-kicad
@futureshocked
futureshocked / i2c_addrs_finder.ino
Created February 26, 2025 02:57
I2C address scanner for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <Wire.h>
#define SDA_PIN 4 // SDA pin connected to GPIO 04
#define SCL_PIN 3 // SCL pin connected to GPIO 03
void setup() {
// Start serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / flash_v1.ino
Created February 26, 2025 02:56
Flash memory tester (SPI) for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <EEPROM.h>
#define EEPROM_SIZE 512 // Size of the EEPROM (in bytes)
#define CS_PIN 10 // Chip Select (CS) pin for SPI flash (GPIO10)
void setup() {
// Initialize serial communication for debugging
Serial.begin(115200);
while (!Serial);
@futureshocked
futureshocked / bme280_v1.ino
Created February 26, 2025 02:56
BME280 tester for techexplorations.com/blog/course/advanced-pcb-design-kicad
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h> // Include the Adafruit BME280 library
#define SDA_PIN 4 // SDA pin connected to GPIO 04
#define SCL_PIN 3 // SCL pin connected to GPIO 03
#define BME280_ADDRESS 0x76 // Specify the I2C address of the BME280 sensor
Adafruit_BME280 bme; // Create an instance of the BME280 sensor
@futureshocked
futureshocked / gist:8d6b34e7e0abd0e121c5ff10a74cf483
Created August 20, 2024 21:24
convert the 4-bit code in the dip_switch array into an integer
byte encodebool(boolean* arr)
{
byte val = 0;
for (int i = 0; i<4; i++)
{
val <<= 1;
if (arr[i]) val |= 1;
}
return val;
}
boolean dip_switch[4];
dip_switch[0] = digitalRead(3);
dip_switch[1] = digitalRead(4);
dip_switch[2] = digitalRead(5);
dip_switch[3] = digitalRead(6);