first commit
This commit is contained in:
53
libraries/LCD03/examples/CustomChars/CustomChars.ino
Executable file
53
libraries/LCD03/examples/CustomChars/CustomChars.ino
Executable file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
CustomChars.ino - Arduino library for I2C LCD03 display from Robot Electronics
|
||||
see http://www.robot-electronics.co.uk/htm/Lcd03tech.htm
|
||||
Copyright (c) 2013 Ben Arblaster. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include <LCD03.h>
|
||||
|
||||
// Create new LCD03 instance
|
||||
LCD03 lcd;
|
||||
|
||||
// Define the custom char bytes
|
||||
byte smiley[8] = {
|
||||
0b00000,
|
||||
0b00000,
|
||||
0b01010,
|
||||
0b00000,
|
||||
0b00000,
|
||||
0b10001,
|
||||
0b01110,
|
||||
0b00000
|
||||
};
|
||||
|
||||
void setup() {
|
||||
// Initialise a 20x4 LCD
|
||||
lcd.begin(20, 4);
|
||||
|
||||
// create a new character
|
||||
lcd.createChar(0, smiley);
|
||||
}
|
||||
|
||||
// Fill the LCD with our custom smiley
|
||||
void loop() {
|
||||
// Write the first custom char to the LCD
|
||||
lcd.write(0);
|
||||
|
||||
// Wait for 1 second
|
||||
delay(1000);
|
||||
}
|
||||
49
libraries/LCD03/examples/HelloWorld/HelloWorld.ino
Executable file
49
libraries/LCD03/examples/HelloWorld/HelloWorld.ino
Executable file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
HelloWorld.ino - Arduino library for I2C LCD03 display from Robot Electronics
|
||||
see http://www.robot-electronics.co.uk/htm/Lcd03tech.htm
|
||||
Copyright (c) 2013 Ben Arblaster. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include <LCD03.h>
|
||||
|
||||
// Create new LCD03 instance
|
||||
LCD03 lcd;
|
||||
|
||||
void setup() {
|
||||
// Initialise a 20x4 LCD
|
||||
lcd.begin(20, 4);
|
||||
|
||||
// Turn on the backlight
|
||||
lcd.backlight();
|
||||
|
||||
// Write to the LCD
|
||||
lcd.print("Hello world");
|
||||
|
||||
// Wait for 5 seconds
|
||||
delay(5000);
|
||||
|
||||
// Clear the LCD
|
||||
lcd.clear();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// Set the cursor to the top left
|
||||
lcd.home();
|
||||
|
||||
// Print the uptime in millis
|
||||
lcd.print(millis());
|
||||
}
|
||||
63
libraries/LCD03/examples/ReadKeypad/ReadKeypad.ino
Executable file
63
libraries/LCD03/examples/ReadKeypad/ReadKeypad.ino
Executable file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
ReadKeypad.ino - Arduino library for I2C LCD03 display from Robot Electronics
|
||||
see http://www.robot-electronics.co.uk/htm/Lcd03tech.htm
|
||||
Copyright (c) 2013 Ben Arblaster. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include <Wire.h>
|
||||
#include <LCD03.h>
|
||||
|
||||
// Create new LCD03 instance
|
||||
LCD03 lcd;
|
||||
|
||||
uint16_t keystate;
|
||||
|
||||
void setup() {
|
||||
// Initialise a 20x4 LCD
|
||||
lcd.begin(20, 4);
|
||||
}
|
||||
|
||||
// Check they keypad state once a second and print to the LCD
|
||||
void loop() {
|
||||
// Clear the display and move the cursor to the top-left
|
||||
lcd.clear();
|
||||
|
||||
// Read the keypad state
|
||||
keystate = lcd.readKeypad();
|
||||
|
||||
// Check if key 1 is pressed
|
||||
if(keystate & KEYPAD_1 == KEYPAD_1) {
|
||||
lcd.print("Key 1 is pressed!");
|
||||
}
|
||||
|
||||
// Check if key 1 is pressed exclusively
|
||||
if(keystate == KEYPAD_1) {
|
||||
lcd.print("Only key 1 is pressed!");
|
||||
}
|
||||
|
||||
// Check if keys 1 and * are pressed simultaneously
|
||||
if(keystate & (KEYPAD_1 | KEYPAD_STAR) == (KEYPAD_1 | KEYPAD_2)) {
|
||||
lcd.print("Keys 1 and * are pressed!");
|
||||
}
|
||||
|
||||
// Check if keys 1 and * are pressed simultaneously exclusively
|
||||
if(keystate == (KEYPAD_1 | KEYPAD_STAR)) {
|
||||
lcd.print("Only keys 1 and * are pressed!");
|
||||
}
|
||||
|
||||
// Wait for 1 second
|
||||
delay(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user