Skip to content

Instantly share code, notes, and snippets.

View johnaboxall's full-sized avatar

John Boxall johnaboxall

View GitHub Profile
@johnaboxall
johnaboxall / 14201491-oled-TCA9548A
Last active April 14, 2025 00:11
Using TCA9548A with OLED on Arduino
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
void TCA9548A(uint8_t bus)
{
Wire.beginTransmission(0x70); // TCA9548A address is 0x70
Wire.write(1 << bus); // send byte to select bus
Wire.endTransmission();
}
@johnaboxall
johnaboxall / 14201491-049-OLED.ino
Last active April 14, 2025 00:11
Demonstration sketch for 0.49" OLED
#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup() {
u8g2.begin();
}
@johnaboxall
johnaboxall / data-rx.ino
Created August 29, 2019 04:44
Data receiver sketch
// data receiver sketch
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
//
#include <VirtualWire.h>
// use onboard LED for status
const int ledPin = 13;
@johnaboxall
johnaboxall / data-tx.ino
Created August 29, 2019 04:44
Data transmitter sketch
// data transmitter sketch
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
//
#include <VirtualWire.h>
// use onboard LED for status
const int ledPin = 13;
@johnaboxall
johnaboxall / remoterx.ino
Created August 29, 2019 01:47
Remote control receiver sketch
// receiver sketch
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
#include <VirtualWire.h>
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
void setup()
{
vw_set_ptt_inverted(true); // Required for RF link modules
@johnaboxall
johnaboxall / remotetx.ino
Created August 29, 2019 01:47
Remote control transmitter sketch
// transmitter sketch
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
#include <VirtualWire.h>
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
const char *on2 = "a";
const char *off2 = "b";
const char *on3 = "c";
@johnaboxall
johnaboxall / receivertest.ino
Last active August 29, 2019 01:31
VirtualWire receiver test sketch
// receiver.ino
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley ([email protected])
// Copyright (C) 2008 Mike McCauley
@johnaboxall
johnaboxall / transmittertest.ino
Last active August 29, 2019 01:31
VirtualWire transmitter test sketch
// transmitter.ino
//
// https://pmdway.com/blogs/product-guides-for-arduino/tutorial-using-long-range-315mhz-rf-wireless-transceivers-with-arduino
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley ([email protected])
// Copyright (C) 2008 Mike McCauley
@johnaboxall
johnaboxall / traffic.ino
Created August 21, 2019 02:24
Arduino-controlled traffic lights
// from https://pmdway.com/blogs/arduino-projects/fun-with-arduino-controlled-traffic-lights
//
// define the I/O pins that are used on the Arduino
// ... the buttons
#define westButton 5
#define eastButton 12
// the LEDs on the traffic light modules
#define westRed 4
#define westYellow 3
@johnaboxall
johnaboxall / GraphicsTestOLED.ino
Created August 20, 2019 08:59
Sketch to test I2C 128 x 64 OLED module from PMD Way
// Display > https://pmdway.com/products/0-96-128-64-graphic-oled-displays-i2c-or-spi-various-colors
// Guide > https://pmdway.com/blogs/product-guides-for-arduino/using-the-0-96-128-x-64-graphic-i2c-oled-displays-with-arduino
#include <Arduino.h>
#include <U8x8lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C