Code: Select all
/*********************************************************************
This is an example sketch for our Monochrome Nokia 5110 LCD Displays
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/products/338
These displays use SPI to communicate, 4 or 5 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, check license.txt for more information
All text above, and the splash screen must be included in any redistribution
*********************************************************************/
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// Software SPI (slower updates, more flexible pin options):
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);
// Hardware SPI (faster, but must use certain hardware pins):
// SCK is LCD serial clock (SCLK) - this is pin 13 on Arduino Uno
// MOSI is LCD DIN - this is pin 11 on an Arduino Uno
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
// Adafruit_PCD8544 display = Adafruit_PCD8544(5, 4, 3);
// Note with hardware SPI MISO and SS pins aren't used but will still be read
// and written to during SPI transfer. Be careful sharing these pins
//2 colour .BMP converted with Image2Code.jar. Black image on white background.
static const unsigned char PROGMEM Curlew[] =
{
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xff,0xc3,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfe,0x14,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfc,0xaf,0x3f,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfc,0x59,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfa,0x88,0xdf,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfc,0xab,0x3d,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xf9,0x54,0x80,0x2f,0xff,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfa,0xef,0xfa,0x81,0x7f,0xff,0xff,0xf0,
0xff,0xff,0xff,0xf9,0xb7,0xff,0x7a,0x7,0xff,0xff,0xf0,
0xff,0xff,0xff,0xf2,0xaf,0xff,0xff,0xe8,0xff,0xff,0xf0,
0xff,0xff,0xff,0xfd,0x7f,0xff,0xff,0xfe,0x3f,0xff,0xf0,
0xff,0xff,0xff,0xf2,0xaf,0xff,0xff,0xff,0x8f,0xff,0xf0,
0xff,0xff,0xff,0xf5,0xf7,0xff,0xff,0xff,0xe3,0xff,0xf0,
0xff,0xff,0xff,0xf5,0x2f,0xff,0xff,0xff,0xfc,0xff,0xf0,
0xff,0xff,0xff,0xf2,0xdf,0xff,0xff,0xff,0xfe,0x7f,0xf0,
0xff,0xff,0xff,0xfa,0x6f,0xff,0xff,0xff,0xff,0x9f,0xf0,
0xff,0xff,0xff,0xe5,0xb7,0xff,0xff,0xff,0xff,0xef,0xf0,
0xff,0xff,0xff,0xea,0xaf,0xff,0xff,0xff,0xff,0xf7,0xf0,
0xff,0xff,0xff,0xd5,0x6f,0xff,0xff,0xff,0xff,0xf9,0xf0,
0xff,0xff,0xff,0xd5,0x57,0xff,0xff,0xff,0xff,0xfd,0xf0,
0xff,0xff,0xff,0x55,0x5f,0xff,0xff,0xff,0xff,0xfe,0x70,
0xff,0xff,0xfc,0xaa,0xd7,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xff,0xc1,0x55,0xaf,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xfe,0x2a,0x15,0x4f,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xf1,0x44,0xa5,0x17,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0xca,0x9a,0x4a,0x67,0xff,0xff,0xff,0xff,0xff,0xf0,
0xff,0x14,0x41,0x94,0x9f,0xff,0xff,0xff,0xff,0xff,0xf0,
0xfc,0x91,0xbc,0xaa,0xa7,0xff,0xff,0xff,0xff,0xff,0xf0,
0xf3,0x6a,0x3,0x45,0x6b,0xff,0xff,0xff,0xff,0xff,0xf0,
0xc4,0x55,0xfe,0x5a,0x4b,0xff,0xff,0xff,0xff,0xff,0xf0,
0x28,0x94,0x84,0x95,0xb7,0xff,0xff,0xff,0xff,0xff,0xf0,
0x7a,0x4a,0x95,0x54,0x53,0xff,0xff,0xff,0xff,0xff,0xf0,
0x87,0xbd,0xd9,0x7b,0xaf,0xff,0xff,0xff,0xff,0xff,0xf0,
0xa4,0x63,0x37,0x12,0x53,0xff,0xff,0xff,0xff,0xff,0xf0,
0x58,0xc2,0x24,0xcd,0xaf,0xff,0xff,0xff,0xff,0xff,0xf0,
0xef,0x9d,0xeb,0x64,0xd7,0xff,0xff,0xff,0xff,0xff,0xf0,
0x89,0xea,0x14,0xdb,0x2f,0xff,0xff,0xff,0xff,0xff,0xf0,
0xbb,0x32,0xe9,0x96,0x7f,0xff,0xff,0xff,0xff,0xff,0xf0
};
void setup() {
Serial.begin(9600);
display.begin();
// init done
// you can change the contrast around to adapt the display
// for the best viewing!
display.setContrast(60);
/*display.display(); // show splashscreen
//delay(2000);
display.clearDisplay(); // clears the screen and buffer
*/
}
void loop() {
// 84X48 bitmap
display.clearDisplay();
display.drawBitmap(0, 0, Curlew, 84, 48, 1);
display.display();
delay (2000);
// text display tests
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
display.println("Curlew");
display.display();
delay(2000);
}