awinograd

Lab 5 - Portal LCD BMP

May 3rd, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.57 KB | None | 0 0
  1. /*
  2.   Graphics
  3.  
  4.  Runs a text-only demo on the Nokia 5110 LCD.
  5.  
  6.  The circuit:
  7.  * Nokia 5110 Connected as follows:
  8. LED   --> 50 Ohm   -->   3.3V
  9. SCLK        -->          Pin 1 (SCLK)
  10. DN(MOSI)    -->          Pin 2 (MOSI)
  11. D/C         -->          Pin 4
  12. RST         -->          Pin 8
  13. SCE         -->          Pin 9
  14. GND         -->          GND
  15. Vcc         -->          Pin 10
  16.  
  17.  By Andrew Lindsay (Adapted by Megan Wachs and edited by Matthew Seal and Akil Srinivasan)
  18.  */
  19.  /*IF we are not using the Graphics or Bitmap capabilities
  20.  of the LCD, save code space with these #defines*/
  21.  
  22. #include <nokia_5110_lcd.h>
  23. #include "pacman.h"
  24. #include "pony_bmp.h"
  25.  
  26. //LCD PINS
  27. #define LCD_PWR   10
  28. #define LCD_SCE   9
  29. #define LCD_RESET 8
  30. #define LCD_DC    4
  31.  
  32. 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,
  33. 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,
  34. 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,
  35. 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,
  36. 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,
  37. 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};
  38.  
  39.  
  40.  
  41. Nokia_5110_lcd lcd(LCD_PWR, LCD_DC, LCD_SCE, LCD_RESET);
  42.  
  43. void setup()
  44. {  
  45.   lcd.init(80); //parameter is contrast value, between 0 [low] and 127 [high]
  46.   lcd.clear();
  47. }
  48.  
  49. /* loop */
  50. void loop() {
  51.   lcd.clear();
  52.   // Draw bitmap image
  53.   lcd.drawBitmap( 0,0, (unsigned char*)portal_img,84,48);
  54.   delay(5000);
  55. }
Advertisement
Add Comment
Please, Sign In to add comment