diff --git a/libraries/PCATTACH/PCATTACH.h b/libraries/PCATTACH/PCATTACH.h index e2bee0e..bb3da60 100644 --- a/libraries/PCATTACH/PCATTACH.h +++ b/libraries/PCATTACH/PCATTACH.h @@ -2,8 +2,7 @@ #define _PCATTACH_H_ #endif -#include -#define uint_8 byte +#include class PCATTACH { @@ -13,8 +12,8 @@ PCATTACH(); -void PCattachInterrupt(byte pin, void (*userFunc)(void), int mode); -void PCdetachInterrupt(byte pin); +void PCattachInterrupt(uint8_t pin, void (*userFunc)(void), int mode); +void PCdetachInterrupt(uint8_t pin); static void PCint(uint8_t); diff --git a/libraries/ShiftLCD/ShiftLCD.cpp b/libraries/ShiftLCD/ShiftLCD.cpp index a7f5a39..2e551a0 100644 --- a/libraries/ShiftLCD/ShiftLCD.cpp +++ b/libraries/ShiftLCD/ShiftLCD.cpp @@ -3,7 +3,7 @@ #include #include #include -#include "WProgram.h" +#include "Arduino.h" /** * 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); } -inline void ShiftLCD::write(uint8_t value) { +inline size_t ShiftLCD::write(uint8_t value) { send(value, true); + return 1; } /************ low level data pushing commands **********/ diff --git a/libraries/ShiftLCD/ShiftLCD.h b/libraries/ShiftLCD/ShiftLCD.h index a62e4a2..be590c4 100644 --- a/libraries/ShiftLCD/ShiftLCD.h +++ b/libraries/ShiftLCD/ShiftLCD.h @@ -113,7 +113,7 @@ public: void createChar(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); private: void updateBacklight(); diff --git a/libraries/ShiftLCD/examples/Autoscroll/Autoscroll.pde b/libraries/ShiftLCD/examples/Autoscroll/Autoscroll.pde new file mode 100644 index 0000000..dc92a52 --- /dev/null +++ b/libraries/ShiftLCD/examples/Autoscroll/Autoscroll.pde @@ -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 + +// 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(); +} + diff --git a/libraries/ShiftLCD/examples/Backlight/Backlight.pde b/libraries/ShiftLCD/examples/Backlight/Backlight.pde new file mode 100644 index 0000000..ec9d112 --- /dev/null +++ b/libraries/ShiftLCD/examples/Backlight/Backlight.pde @@ -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 + +// 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); +} diff --git a/libraries/ShiftLCD/examples/Blink/Blink.pde b/libraries/ShiftLCD/examples/Blink/Blink.pde new file mode 100644 index 0000000..60c2805 --- /dev/null +++ b/libraries/ShiftLCD/examples/Blink/Blink.pde @@ -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 + +// 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); +} + + diff --git a/libraries/ShiftLCD/examples/CreateChar/CreateChar.pde b/libraries/ShiftLCD/examples/CreateChar/CreateChar.pde new file mode 100644 index 0000000..aed3125 --- /dev/null +++ b/libraries/ShiftLCD/examples/CreateChar/CreateChar.pde @@ -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 + + // 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() + { + } diff --git a/libraries/ShiftLCD/examples/Cursor/Cursor.pde b/libraries/ShiftLCD/examples/Cursor/Cursor.pde new file mode 100644 index 0000000..99181d1 --- /dev/null +++ b/libraries/ShiftLCD/examples/Cursor/Cursor.pde @@ -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 + +// 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); +} + diff --git a/libraries/ShiftLCD/examples/Display/Display.pde b/libraries/ShiftLCD/examples/Display/Display.pde new file mode 100644 index 0000000..cc76da2 --- /dev/null +++ b/libraries/ShiftLCD/examples/Display/Display.pde @@ -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 + +// 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); +} + diff --git a/libraries/ShiftLCD/examples/HelloWorld/HelloWorld.pde b/libraries/ShiftLCD/examples/HelloWorld/HelloWorld.pde new file mode 100644 index 0000000..0eb8d09 --- /dev/null +++ b/libraries/ShiftLCD/examples/HelloWorld/HelloWorld.pde @@ -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 + +// 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); +} + diff --git a/libraries/ShiftLCD/examples/Scroll/Scroll.pde b/libraries/ShiftLCD/examples/Scroll/Scroll.pde new file mode 100644 index 0000000..78c2c1b --- /dev/null +++ b/libraries/ShiftLCD/examples/Scroll/Scroll.pde @@ -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 + +// 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); + } +} + diff --git a/libraries/ShiftLCD/examples/SerialDisplay/SerialDisplay.pde b/libraries/ShiftLCD/examples/SerialDisplay/SerialDisplay.pde new file mode 100644 index 0000000..1a93485 --- /dev/null +++ b/libraries/ShiftLCD/examples/SerialDisplay/SerialDisplay.pde @@ -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 + +// 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()); + } + } +} diff --git a/libraries/ShiftLCD/examples/TextDirection/TextDirection.pde b/libraries/ShiftLCD/examples/TextDirection/TextDirection.pde new file mode 100644 index 0000000..e6199e3 --- /dev/null +++ b/libraries/ShiftLCD/examples/TextDirection/TextDirection.pde @@ -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 + +// 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++; +} + + + + + + + + diff --git a/libraries/ShiftLCD/examples/setCursor/setCursor.pde b/libraries/ShiftLCD/examples/setCursor/setCursor.pde new file mode 100644 index 0000000..4adf0a6 --- /dev/null +++ b/libraries/ShiftLCD/examples/setCursor/setCursor.pde @@ -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 + +// 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); + } + } + } +} + + diff --git a/libraries/Wiegand26/WIEGAND26.h b/libraries/Wiegand26/WIEGAND26.h index 374cfb0..621b2d3 100644 --- a/libraries/Wiegand26/WIEGAND26.h +++ b/libraries/Wiegand26/WIEGAND26.h @@ -2,7 +2,7 @@ #define _WIEGAND26_H_ #endif -#include +#include class WIEGAND26 { public: