Maintenance notice: These forum archives are read-only, and will be removed shortly. Please visit our forums at their new location, https://www.evilmadscientist.com/forums/.

Peggy 2/2LE Photo Display Part 1

edited December 2012 in General

Here's a sketch I cobbled together for displaying greyscale images. Any comments / suggestions will be greatly appreciated.

===================

/*
Peggy2PhotoDisplay.ino
 Robert Lee (leerm8680@yahoo.com)
 Updated: 16 Dec 2012
 Sketch concept: rotating picture frame for Peggy 2/2LE
 
 Sketch was cobbled together from the Peggy2_16level demo included with the
 Peggy2 Library. BMP2PEG was used to create the tables for the bmp-bitmap
 data. The Arduino Flash Library is used to load the tables into flash
 memory to save space / load more pictures. All I have done is taken
 pieces of data, placed them in an editor, and shook my laptop like an
 etch-a-sketch and hoped for the best. I have still a long way to go with
 this.
 
 
 Thank you Messrs. Oskay, Hart, and Delp for your hard and excellent work.
 I would be the onwner of a LED-enhanced paperwork without you.
 
 
 Here are the specifics for those who made this all possible:
 Peggy 2LE board designed by Evil Mad Scientist.
 (aligning the LEDs into a military-precision formation worked wonders for my OCD
 and
 Peggy2_16level.pde - Simple example code for Peggy 2.0, using the Peggy2 library, version 0.2.
 Generate four frame buffers and switch between them *fast* to make gray scale.
 Copyright (c) 2008 Windell H Oskay.
 http://www.evilmadscientist.com/2009/peggy-2le/
 
 Flash Arduino Library
 Loads data into flash memory instead of SRAM
            and
 flash_example.pde
 A program to demonstrate the Arduino Flash library
 Copyright (C) 2009 Mikal Hart
 http://arduiniana.org/libraries/flash/
 
 Image tables made by BMP2PEG.
 Converts bmp images into 16-bit data tables.
 Copyright (c) 2009 Mark Delp.
 http://mickeydelp.com/news/50-bmp2peg-bitmap-to-peggy.html
  
 Sketch by Anonymous: Ben S. led me on the path to using flash memory,
 and souce of Ben Franklin table data (via BMP2PEG)
  http://www2.evilmadscientist.com/forum/viewtopic.php?showtopic=2324
 */

#include <Peggy2.h>
#include <Flash.h>


int PictureNumber = 2;   // Picture Number (Start with your favorite)
int CountNumber = 1;     // Counter used to time display
int PictureNew = 1;  // Was this the picture from the last time?


/* The table is loaded into flash memony instead of into
 SRAM. Commented numbers are to keep things straight in my head*/
FLASH_TABLE(uint32_t, PictureTable, 25 /* width of table */,
// [1] Ben Franklin
{
  0x007E8BFF, 0x00EF9ADF, 0x008374BF, 0x0007797B, 0x000E55DF, 0x0002ECFD, 0x00019AAF, 0x00350DB5, 0x002E913F, 0x001AE8E5, 0x002B9C6F, 0x003845ED, 0x007AB6D7, 0x0059AECD, 0x00601DC7, 0x007519B6, 0x017F0FBF, 0x00B132A1, 0x009915CF, 0x015CCD2D, 0x00E8ED49, 0x00DC2453, 0x01B937A8, 0x01BEDC8C, 0x005DF688}
,
{
  0x01806C00, 0x01166A00, 0x017CFD00, 0x01F4D980, 0x01FE4580, 0x01F04980, 0x01FB3BC0, 0x01C84AC0, 0x01D80E40, 0x01EE1FF0, 0x01D9F9C0, 0x01D47AD0, 0x01966A78, 0x019C1208, 0x01924008, 0x0186EA70, 0x0188DC7C, 0x01CA947C, 0x01EC6E30, 0x01FFDEF0, 0x01FFCC14, 0x01F3B8B8, 0x01E36843, 0x01C494C6, 0x01B760C8}
,
{
  0x0001F000, 0x00020C00, 0x00040600, 0x000C2200, 0x00063E00, 0x00083200, 0x0007E000, 0x0002A000, 0x0003F080, 0x00034000, 0x00040230, 0x00080220, 0x00090320, 0x00020330, 0x000E4230, 0x000A0A08, 0x00061E00, 0x00063700, 0x0003FB00, 0x00003500, 0x000039F8, 0x000051FA, 0x00008BE3, 0x000197CE, 0x001BE7D8}
,
{
  0x00000000, 0x0001F000, 0x0003F800, 0x0003FC00, 0x0001F800, 0x0007FC00, 0x00001C00, 0x00011C00, 0x00010C00, 0x0001BC00, 0x0003FC00, 0x0003FC00, 0x0000FC00, 0x0001FC00, 0x0001BC00, 0x0001F400, 0x0001E000, 0x0001CA00, 0x00000600, 0x00000E00, 0x00001E00, 0x00003E04, 0x0000741C, 0x00006831, 0x000C1827}
,
// [2] - Football Helmet
{
  0x01FF107F, 0x01FCB95F, 0x01FA002F, 0x01F27F17, 0x01EDFFDB, 0x01F3FFFD, 0x01C32011, 0x01D67830, 0x01B5FFCE, 0x0164FFDA, 0x0162E07A, 0x0134AFFA, 0x013993FA, 0x019281F2, 0x01EC7DE6, 0x0189F998, 0x010DE012, 0x00732D01, 0x00FA193F, 0x00DF047F, 0x00EC62FF, 0x007A83FF, 0x0005FFFF, 0x0143FFFF, 0x0177FFFF}
,
{
  0x00000C00, 0x00001480, 0x000300A0, 0x00040010, 0x00040008, 0x00080000, 0x00080004, 0x000077E6, 0x0011FFC2, 0x0072FF00, 0x00616000, 0x004D4000, 0x0035C000, 0x00134C00, 0x000E3C0E, 0x000C940C, 0x007D7320, 0x00AFA2C0, 0x00F8A000, 0x0095C700, 0x00781C00, 0x00B20000, 0x00840000, 0x00580000, 0x00000000}
,
{
  0x00000000, 0x0000E300, 0x00010040, 0x00060030, 0x00080008, 0x00080008, 0x00100004, 0x0010FA66, 0x0030FFE0, 0x0021FF02, 0x0061F002, 0x003F8002, 0x00660002, 0x000D8402, 0x0002CC0C, 0x0003640E, 0x002F503E, 0x007F60C0, 0x00B90180, 0x00FA0300, 0x009E7800, 0x007A0000, 0x00AC0000, 0x00580000, 0x00200000}
,
{
  0x00000000, 0x00007F80, 0x00018060, 0x00020010, 0x00040008, 0x00080004, 0x00100014, 0x0010FC20, 0x0001FFC2, 0x0021FF82, 0x0000E002, 0x00406002, 0x00380002, 0x00060802, 0x00070C06, 0x0006080E, 0x0019007C, 0x00C30080, 0x00BE8100, 0x00A3C200, 0x00BA3C00, 0x00BC0000, 0x00740000, 0x00780000, 0x00000000}
,
// [3] - Eienstein
{
  0x00164BC0, 0x000F5F48, 0x00288AE2, 0x0020FD14, 0x0045366C, 0x01619B68, 0x00159994, 0x005C1676, 0x00016AFA, 0x00C84984, 0x00159EE2, 0x0133CEBE, 0x001FE4B4, 0x00FB8BD2, 0x0191536C, 0x008F0A41, 0x015C3302, 0x0098819E, 0x00B2A528, 0x016C9578, 0x00AFFEB4, 0x0049FE50, 0x0000D6C0, 0x007E2120, 0x001D5080}
,
{
  0x000B32C0, 0x00148960, 0x001F4960, 0x000F6530, 0x000F1C88, 0x001FE1C4, 0x005BE330, 0x0043E158, 0x00338954, 0x00739150, 0x00CEC16C, 0x00F339B8, 0x005147FC, 0x001AFA1C, 0x00926CA0, 0x00B07634, 0x00C8AFCC, 0x002DFD68, 0x0184A200, 0x01F79F80, 0x015DE080, 0x002C0400, 0x0039B980, 0x00046000, 0x00040000}
,
{
  0x0006FC80, 0x000BF640, 0x0017F670, 0x000F8238, 0x003EE0E8, 0x003FFDA4, 0x003FFDF4, 0x003FFDB0, 0x007FF5B0, 0x003FEDB4, 0x003B3C88, 0x000C204C, 0x008C3844, 0x008CFDD4, 0x00273FE4, 0x0026FFF4, 0x0063BBFC, 0x000317C0, 0x000F5FC0, 0x00765840, 0x000F4080, 0x00179980, 0x0002E100, 0x00018000, 0x00020000}
,
{
  0x0001FF00, 0x0007FF80, 0x000FFF80, 0x001FFFC0, 0x001FFF10, 0x001FFE18, 0x003FFE08, 0x003FFE0C, 0x003FFE0C, 0x007FFE08, 0x007FF810, 0x007E1000, 0x007E1008, 0x00773028, 0x007FF018, 0x007FF008, 0x003FF000, 0x007FE000, 0x007FE000, 0x000FE000, 0x00060040, 0x000660C0, 0x00040000, 0x00008000, 0x00000000}
,

Sign In or Register to comment.