Skip to content

Instantly share code, notes, and snippets.

View boxalljohn's full-sized avatar

John Boxall boxalljohn

View GitHub Profile
matrix.setRotation(0);
matrix.setTextSize(1);
matrix.setTextWrap(false); // false means nice scroll, true means each character appears, scrolls off, then repeat
matrix.setTextColor(LED_ON);
for (int8_t x=0; x>=-96; x--) // 96 is number of characters to display x 8
{
matrix.clear();
matrix.setCursor(x,0);
matrix.print("Hello, world");
matrix.writeDisplay();
// required libraries
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
// define matrix object
Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
void setup()
{
@boxalljohn
boxalljohn / 1Hz
Last active December 20, 2015 10:49
// DS1307 Square-wave machine sketch for Arduino
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68 // each I2C object has a unique bus address, the DS1307 is 0x68
void setup()
{
Wire.begin();
}
/*
exercise 0.1 - KITT emulator!
Created 02/04/2010
By John Boxall
http://tronixstuff.com...
Blinks LEDs from output pin 2~9 in a forwards<>backward motion
The circuit:
an LED is connected to each output pin from 2 to 8, thence to a 560 ohm resistor, then to ground (pin 4 on the bottom left of the Arduino Duemilanove).
based on an orginal by H. Barragan for the Wiring i/o board
*/
/*
example 1.2 - fun with PWM and RGB LED - Created 07/04/2010 --- CC by-sa v3.0 Share the love!
By John Boxall --- http://tronixstuff.com
*/
int red = 11; // the pins for the LED
int green = 9;
int blue = 10;
int i = 0; // for loops
int j = 0;
void setup()
/*
exercise 1.1 - using the 'for' command in exercise 0.1
Created 02/04/2010 --- CC by-sa v3.0 Share the love! - By John Boxall --- http://tronixstuff.com
Based on an orginal by H. Barragan for the Wiring i/o board
*/
int del=100; // sets a default delay time, 1000 milliseconds (one second)
void setup()
{
// initialize the digital pins as outputs:
/* Example 1.1 - using the 'for' command
Created 02/04/2010 --- CC by-sa v3.0 Share the love!
By John Boxall --- http://tronixstuff.com
Blinks LED on digital port 9 five times...
Based on an orginal by H. Barragan for the Wiring i/o board
*/
void setup()
{
digitalWrite(2, HIGH); // turn on LED on pin 2
delay(del); // wait (length determined by value of ‘del’)
digitalWrite(2, LOW); // turn it off
digitalWrite(3, HIGH); // turn on LED on pin 3
delay(del); // wait
digitalWrite(3, LOW); // turn it off
digitalWrite(4, HIGH); // turn on LED on pin 4
delay(del); // wait
digitalWrite(4, LOW); // turn it off
digitalWrite(5, HIGH); // turn on LED on pin 5
/*
exercise 2.1 - Climate Control Judge
Created 14/04/2010 --- By John Boxall --- http://tronixstuff.com --- CC by-sa v3.0 Share the love!
Measures temperature with Analog Devices TMP36 and compares against minimum temperature to use a heater or air conditioner
*/
int redLED = 13; // define which colour LED is in which digital output
int greenLED = 12;
int blueLED = 11;
float voltage = 0; // set up some variables for temperature work
float sensor = 0;
/*
example 2.1 - digital thermometer
Created 14/04/2010 --- By John Boxall --- http://tronixstuff.com --- CC by-sa v3.0
Uses an Analog Devices TMP36 temperature sensor to measure temperature and output values to the serial connection
Pin 1 of TMP36 to Arduino 5V power socket
Pin 2 of TMP36 to Arduino analog 0 socket
Pin 3 of TMP36 to Arduino GND socket
*/
void setup()
{