mirror of
https://github.com/zyphlar/open-access-control-minimal-http.git
synced 2024-03-08 15:57:47 +00:00
Library Arduino 1.0 compatibility
This commit is contained in:
parent
9e06348d2d
commit
f8349ad38e
|
@ -2,8 +2,7 @@
|
||||||
#define _PCATTACH_H_
|
#define _PCATTACH_H_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <WProgram.h>
|
#include <Arduino.h>
|
||||||
#define uint_8 byte
|
|
||||||
|
|
||||||
class PCATTACH {
|
class PCATTACH {
|
||||||
|
|
||||||
|
@ -13,8 +12,8 @@ PCATTACH();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PCattachInterrupt(byte pin, void (*userFunc)(void), int mode);
|
void PCattachInterrupt(uint8_t pin, void (*userFunc)(void), int mode);
|
||||||
void PCdetachInterrupt(byte pin);
|
void PCdetachInterrupt(uint8_t pin);
|
||||||
|
|
||||||
|
|
||||||
static void PCint(uint8_t);
|
static void PCint(uint8_t);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "WProgram.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a modified version of the standard LiquidCrystal class that
|
* This is a modified version of the standard LiquidCrystal class that
|
||||||
|
@ -249,8 +249,9 @@ inline void ShiftLCD::command(uint8_t value) {
|
||||||
send(value, false);
|
send(value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ShiftLCD::write(uint8_t value) {
|
inline size_t ShiftLCD::write(uint8_t value) {
|
||||||
send(value, true);
|
send(value, true);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************ low level data pushing commands **********/
|
/************ low level data pushing commands **********/
|
||||||
|
|
|
@ -113,7 +113,7 @@ public:
|
||||||
|
|
||||||
void createChar(uint8_t, uint8_t[]);
|
void createChar(uint8_t, uint8_t[]);
|
||||||
void setCursor(uint8_t, uint8_t);
|
void setCursor(uint8_t, uint8_t);
|
||||||
virtual void write(uint8_t);
|
virtual size_t write(uint8_t);
|
||||||
void command(uint8_t);
|
void command(uint8_t);
|
||||||
private:
|
private:
|
||||||
void updateBacklight();
|
void updateBacklight();
|
||||||
|
|
89
libraries/ShiftLCD/examples/Autoscroll/Autoscroll.pde
Normal file
89
libraries/ShiftLCD/examples/Autoscroll/Autoscroll.pde
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Autoscroll
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch demonstrates the use of the autoscroll()
|
||||||
|
and noAutoscroll() functions.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of columns and rows:
|
||||||
|
lcd.begin(16,2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// set the cursor to (0,0):
|
||||||
|
lcd.setCursor(0, 0);
|
||||||
|
// print from 0 to 9:
|
||||||
|
for (int thisChar = 0; thisChar < 10; thisChar++) {
|
||||||
|
lcd.print(thisChar);
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set the cursor to (16,1):
|
||||||
|
lcd.setCursor(16,1);
|
||||||
|
// set the display to automatically scroll:
|
||||||
|
lcd.autoscroll();
|
||||||
|
// print from 0 to 9:
|
||||||
|
for (int thisChar = 0; thisChar < 10; thisChar++) {
|
||||||
|
lcd.print(thisChar);
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
// turn off automatic scrolling
|
||||||
|
lcd.noAutoscroll();
|
||||||
|
|
||||||
|
// clear screen for the next loop:
|
||||||
|
lcd.clear();
|
||||||
|
}
|
||||||
|
|
75
libraries/ShiftLCD/examples/Backlight/Backlight.pde
Normal file
75
libraries/ShiftLCD/examples/Backlight/Backlight.pde
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Backlight
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch displays "Hello, World!" and then flashes the display
|
||||||
|
on and off once a second
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
Example by
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initalise the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2,4,3);
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16,2);
|
||||||
|
// Output Hello, World!
|
||||||
|
lcd.print("Hello, World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// Turn the backlight on
|
||||||
|
lcd.backlightOn();
|
||||||
|
delay(1000);
|
||||||
|
// Turn the backlight off
|
||||||
|
lcd.backlightOff();
|
||||||
|
delay(1000);
|
||||||
|
}
|
75
libraries/ShiftLCD/examples/Blink/Blink.pde
Normal file
75
libraries/ShiftLCD/examples/Blink/Blink.pde
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Blink
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello World!" and makes the cursor blink
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2,4,3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// Print a message to the LCD.
|
||||||
|
lcd.print("hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// Turn off the blinking cursor:
|
||||||
|
lcd.noBlink();
|
||||||
|
delay(3000);
|
||||||
|
// Turn on the blinking cursor:
|
||||||
|
lcd.blink();
|
||||||
|
delay(3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
84
libraries/ShiftLCD/examples/CreateChar/CreateChar.pde
Normal file
84
libraries/ShiftLCD/examples/CreateChar/CreateChar.pde
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - CreateChar
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello, World!" and then adds a smiley after it
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
Example based on the code from the arduino.cc reference library for LiquidCrystal
|
||||||
|
Chris Parish, January 17th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
//include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initalise the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2,4,3);
|
||||||
|
|
||||||
|
//define the smiley
|
||||||
|
byte smiley[8] = {
|
||||||
|
B00000,
|
||||||
|
B10001,
|
||||||
|
B00000,
|
||||||
|
B00000,
|
||||||
|
B10001,
|
||||||
|
B01110,
|
||||||
|
B00000,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// create the character. This must be done before calling lcd.begin
|
||||||
|
lcd.createChar(0, smiley);
|
||||||
|
// initalise the display with the number of row and colums:
|
||||||
|
lcd.begin(16,2);
|
||||||
|
// output Hello World to the display:
|
||||||
|
lcd.print("Hello, World!");
|
||||||
|
// output the custom character:
|
||||||
|
lcd.write(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
}
|
76
libraries/ShiftLCD/examples/Cursor/Cursor.pde
Normal file
76
libraries/ShiftLCD/examples/Cursor/Cursor.pde
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Cursor
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello World!" to the LCD and
|
||||||
|
uses the cursor() and noCursor() methods to turn
|
||||||
|
on and off the cursor.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// Print a message to the LCD.
|
||||||
|
lcd.print("hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// Turn off the cursor:
|
||||||
|
lcd.noCursor();
|
||||||
|
delay(500);
|
||||||
|
// Turn on the cursor:
|
||||||
|
lcd.cursor();
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
76
libraries/ShiftLCD/examples/Display/Display.pde
Normal file
76
libraries/ShiftLCD/examples/Display/Display.pde
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Display
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello World!" to the LCD and uses the
|
||||||
|
display() and noDisplay() functions to turn on and off
|
||||||
|
the display.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// Print a message to the LCD.
|
||||||
|
lcd.print("hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// Turn off the display:
|
||||||
|
lcd.noDisplay();
|
||||||
|
delay(500);
|
||||||
|
// Turn on the display:
|
||||||
|
lcd.display();
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
74
libraries/ShiftLCD/examples/HelloWorld/HelloWorld.pde
Normal file
74
libraries/ShiftLCD/examples/HelloWorld/HelloWorld.pde
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Hello World
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello World!" to the LCD
|
||||||
|
and shows the time.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// Print a message to the LCD.
|
||||||
|
lcd.print("Hello, World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// set the cursor to column 0, line 1
|
||||||
|
// (note: line 1 is the second row, since counting begins with 0):
|
||||||
|
lcd.setCursor(0, 1);
|
||||||
|
// print the number of seconds since reset:
|
||||||
|
lcd.print(millis()/1000);
|
||||||
|
}
|
||||||
|
|
86
libraries/ShiftLCD/examples/Scroll/Scroll.pde
Normal file
86
libraries/ShiftLCD/examples/Scroll/Scroll.pde
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - Scroll
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints "Hello World!" to the LCD and uses the
|
||||||
|
scrollDisplayLeft() and scrollDisplayRight() methods to scroll
|
||||||
|
the text.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
lcd.setCursor(0,7);
|
||||||
|
// Print a message to the LCD.
|
||||||
|
lcd.print("hello, world!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// scroll 27 positions (display length + string length) to the left:
|
||||||
|
for (int positionCounter = 0; positionCounter < 27; positionCounter++) {
|
||||||
|
// scroll one position left:
|
||||||
|
lcd.scrollDisplayLeft();
|
||||||
|
// wait a bit:
|
||||||
|
delay(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// scroll 27 positions (display length + string length) to the right:
|
||||||
|
for (int positionCounter = 0; positionCounter < 27; positionCounter++) {
|
||||||
|
// scroll one position right:
|
||||||
|
lcd.scrollDisplayRight();
|
||||||
|
// wait a bit:
|
||||||
|
delay(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
81
libraries/ShiftLCD/examples/SerialDisplay/SerialDisplay.pde
Normal file
81
libraries/ShiftLCD/examples/SerialDisplay/SerialDisplay.pde
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - SerialDisplay
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch displays text sent over the serial port
|
||||||
|
(e.g. from the Serial Monitor) on an attached LCD.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup(){
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// initialize the serial communications:
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// when characters arrive over the serial port...
|
||||||
|
if (Serial.available()) {
|
||||||
|
// wait a bit for the entire message to arrive
|
||||||
|
delay(100);
|
||||||
|
// clear the screen
|
||||||
|
lcd.clear();
|
||||||
|
// read all the available characters
|
||||||
|
while (Serial.available() > 0) {
|
||||||
|
// display each character to the LCD
|
||||||
|
lcd.write(Serial.read());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
102
libraries/ShiftLCD/examples/TextDirection/TextDirection.pde
Normal file
102
libraries/ShiftLCD/examples/TextDirection/TextDirection.pde
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - TextDirection
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch demonstrates how to use leftToRight() and rightToLeft()
|
||||||
|
to move the cursor.
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
int thisChar = 'a';
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(16, 2);
|
||||||
|
// turn on the cursor:
|
||||||
|
lcd.cursor();
|
||||||
|
Serial.begin(9600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// reverse directions at 'm':
|
||||||
|
if (thisChar == 'm') {
|
||||||
|
// go right for the next letter
|
||||||
|
lcd.rightToLeft();
|
||||||
|
}
|
||||||
|
// reverse again at 's':
|
||||||
|
if (thisChar == 's') {
|
||||||
|
// go left for the next letter
|
||||||
|
lcd.leftToRight();
|
||||||
|
}
|
||||||
|
// reset at 'z':
|
||||||
|
if (thisChar > 'z') {
|
||||||
|
// go to (0,0):
|
||||||
|
lcd.home();
|
||||||
|
// start again at 0
|
||||||
|
thisChar = 'a';
|
||||||
|
}
|
||||||
|
// print the character
|
||||||
|
lcd.print(thisChar, BYTE);
|
||||||
|
// wait a second:
|
||||||
|
delay(1000);
|
||||||
|
// increment the letter:
|
||||||
|
thisChar++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
87
libraries/ShiftLCD/examples/setCursor/setCursor.pde
Normal file
87
libraries/ShiftLCD/examples/setCursor/setCursor.pde
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
ShiftLCD Library - setCursor
|
||||||
|
|
||||||
|
Demonstrates the use a 16x2 LCD display. The ShiftLCD library works with
|
||||||
|
all LCD displays that are compatible with the Hitachi HD44780 driver.
|
||||||
|
There are many of them out there, and you can usually tell them by the
|
||||||
|
16-pin interface.
|
||||||
|
|
||||||
|
This sketch prints to all the positions of the LCD using the
|
||||||
|
setCursor method:
|
||||||
|
|
||||||
|
The circuit:
|
||||||
|
|
||||||
|
---Shift Register 74HC595---
|
||||||
|
* SR Pin 14 to Arduino pin 2
|
||||||
|
* SR Pin 12 to Arduino pin 3
|
||||||
|
* SR Pin 11 to Arduino pin 4
|
||||||
|
* SR Pin 8 to Ground
|
||||||
|
* SR Pin 16 to +5v
|
||||||
|
* SR Pin 13 to Ground
|
||||||
|
* SR Pin 10 to +5v
|
||||||
|
-----Shift Reg to LCD--------
|
||||||
|
* SR Pin 15 to D7
|
||||||
|
* SR Pin 1 to D6
|
||||||
|
* SR Pin 2 to D5
|
||||||
|
* SR Pin 3 to D4
|
||||||
|
* SR Pin 5 to MOSFET gate
|
||||||
|
* SR Pin 6 to Enable
|
||||||
|
* SR Pin 7 to RS
|
||||||
|
-----LCD HD44780-------------
|
||||||
|
* Vss to Ground
|
||||||
|
* Vdd to +5V
|
||||||
|
* Vo to 10k Wiper
|
||||||
|
* R/W to Ground
|
||||||
|
* 5v to +5v
|
||||||
|
* Gnd to MOSFET Drain
|
||||||
|
------N Chanel MOSFET--------
|
||||||
|
* Source to Ground
|
||||||
|
* Gate to SP Pin 5
|
||||||
|
* Drain to LCD Gnd
|
||||||
|
* 1k Resistor Between gate and source
|
||||||
|
|
||||||
|
For a more detailed schematic, please see my blog:
|
||||||
|
|
||||||
|
http://cjparish.blogspot.com/2010/01/controlling-lcd-display-with-shift.html
|
||||||
|
|
||||||
|
Library modified from the original LiquidCrystal Library
|
||||||
|
This example originaly by Tom Igoe, Jul 2009
|
||||||
|
Example modified for use with ShiftLCD
|
||||||
|
Chris Parish, January 12th 2010
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// include the library code:
|
||||||
|
#include <ShiftLCD.h>
|
||||||
|
|
||||||
|
// these constants won't change. But you can change the size of
|
||||||
|
// your LCD using them:
|
||||||
|
const int numRows = 2;
|
||||||
|
const int numCols = 16;
|
||||||
|
|
||||||
|
// initialize the library with the numbers of the interface pins
|
||||||
|
ShiftLCD lcd(2, 4, 3);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
// set up the LCD's number of rows and columns:
|
||||||
|
lcd.begin(numRows, numCols);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// loop from ASCII 'a' to ASCII 'z':
|
||||||
|
for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
|
||||||
|
// loop over the columns:
|
||||||
|
for (int thisCol = 0; thisCol < numRows; thisCol++) {
|
||||||
|
// loop over the rows:
|
||||||
|
for (int thisRow = 0; thisRow < numCols; thisRow++) {
|
||||||
|
// set the cursor position:
|
||||||
|
lcd.setCursor(thisRow,thisCol);
|
||||||
|
// print the letter:
|
||||||
|
lcd.print(thisLetter, BYTE);
|
||||||
|
delay(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define _WIEGAND26_H_
|
#define _WIEGAND26_H_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <WProgram.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
class WIEGAND26 {
|
class WIEGAND26 {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user