Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Graphics
- Runs a text-only demo on the Nokia 5110 LCD.
- The circuit:
- * Nokia 5110 Connected as follows:
- LED --> 50 Ohm --> 3.3V
- SCLK --> Pin 1 (SCLK)
- DN(MOSI) --> Pin 2 (MOSI)
- D/C --> Pin 4
- RST --> Pin 8
- SCE --> Pin 9
- GND --> GND
- Vcc --> Pin 10
- By Andrew Lindsay (Adapted by Megan Wachs and edited by Matthew Seal and Akil Srinivasan)
- */
- /*IF we are not using the Graphics or Bitmap capabilities
- of the LCD, save code space with these #defines*/
- #include <nokia_5110_lcd.h>
- #include "pacman.h"
- #include "pony_bmp.h"
- //LCD PINS
- #define LCD_PWR 10
- #define LCD_SCE 9
- #define LCD_RESET 8
- #define LCD_DC 4
- const char portal_img[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0x0E,0x1C,0x3C,0xF8,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xF8,0xFE,0xFF,0xFF,0x3F,0x0F,0x07,0x07,0x03,0x03,0x03,0x07,0x07,0x0F,0x3F,0xFF,0xFF,0xFE,0xF8,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x60,0x70,0x3C,0x1C,0x06,0x06,0x0C,0x18,0x38,0x71,0xFF,0xFF,0xE0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0x80,0x00,0x00,0xF8,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x78,0xF0,0xC0,0x81,0x07,0xDF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFC,0xE6,0xE3,0xE1,0xC1,0x01,0x03,0x03,0x07,0x06,0x04,0x00,0x00,0x1F,0x3F,0x3F,0x3F,0x3F,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x1F,0x0F,0x07,0x01,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xFF,0xFF,0xFF,0xFF,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x03,0x03,0x01,0x00,0x00,0x03,0x0F,0x1F,0x1F,0x1F,0x1F,0x0F,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x0F,0x3F,0x7F,0xFF,0xFE,0xF8,0xF0,0xC0,0xC0,0x80,0x80,0x80,0xC0,0xC0,0xE0,0xF8,0xFE,0xFF,0x7F,0x3F,0x0F,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x0F,0x0F,0x0F,0x07,0x07,0x03,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
- Nokia_5110_lcd lcd(LCD_PWR, LCD_DC, LCD_SCE, LCD_RESET);
- void setup()
- {
- lcd.init(80); //parameter is contrast value, between 0 [low] and 127 [high]
- lcd.clear();
- }
- /* loop */
- void loop() {
- lcd.clear();
- // Draw bitmap image
- lcd.drawBitmap( 0,0, (unsigned char*)portal_img,84,48);
- delay(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment