Skip to content

Instantly share code, notes, and snippets.

View johnaboxall's full-sized avatar

John Boxall johnaboxall

View GitHub Profile
void setup()
{
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again, forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
@johnaboxall
johnaboxall / example1-1.ino
Created August 1, 2019 13:01
Example 1-1
int i = 1000;
void setup()
{
pinMode(3, OUTPUT); // sets digital pin 3 to an output
pinMode(6, OUTPUT); // sets digital pin 6 to an output
}
void loop()
{
@johnaboxall
johnaboxall / example1-2.ino
Created August 1, 2019 14:41
Example 1-2 - PWM
int i = 1000;
void setup()
{
pinMode(3, OUTPUT); // sets digital pin 3 to an output
pinMode(6, OUTPUT); // sets digital pin 6 to an output
}
void loop()
{
@johnaboxall
johnaboxall / exampleTFT80160.ino
Created August 20, 2019 01:49
Demo sketch for 0.96" 80 x 160 Full Color IPS LCD Module from PMD Way
// https://pmdway.com/blogs/news/using-the-0-96-80-x-160-full-color-ips-lcd-module-with-arduino
// https://pmdway.com/products/0-96-80-x-160-full-color-lcd-module
#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
// Initialize display
// Library only supports software SPI at this time
//NOTE: support DUE , MEGA , UNO
@johnaboxall
johnaboxall / i2cscanner.ino
Created August 20, 2019 06:32
I2C bus scanner for Arduino
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
@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
@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 / 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 (mikem@airspayce.com)
// 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 (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
@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";