Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Sound Following Servo on: September 26, 2012, 10:29:07 am
basically im trying to make a sound following servo to start with using 5 electret mics and some op amps what im trying to figure out is how to program this while taking up the least amount of ram on the arduino that being said i want to take the five inputs from the mic and compare them and choose which is larger or if 2 of them are approximately the same

in a nutshell what i want to do is
if M1 > M2,M3, M4,M5 goto position 1
if (M1 ≈ M2) > M3, M4,M5 goto position 2
if M2 > M1,M3, M4,M5 goto position 3
if (M2 ≈ M3) > M1, M4,M5 goto position 4
if M3 > M2,M1, M4,M5 goto position 5
if (M3 ≈ M4) > M1, M2,M5 goto position 6
if M4 > M2,M3, M1,M5  goto position 7
if (M4 ≈ M5) > M3, M1,M2 goto position 8
if M5 > M2,M3, M4,M1 goto position 9

if anyone has any better ideas then a bunch of if statements and nested if statements it would be much appreciated for 2 reasons one i want to save on memory and 2 i really dont want to write all those if statements lol
2  Topics / Product Design / Re: arduino schematic pictures help on: August 14, 2012, 03:21:56 pm
excellent thank you that was it
3  Topics / Product Design / arduino schematic pictures help on: August 14, 2012, 01:36:21 pm
okay so i see these picture everywhere but i can figure out how to make them. i want to make some to represent my project for class so if anyone can help i would appreciate it her are a few of the pictures im talking about
 

4  Using Arduino / LEDs and Multiplexing / Re: max7219 expert needed 8x64 matrix on: February 27, 2012, 02:39:09 pm
here is the library
Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

#ifndef FONT_H_
#define FONT_H_

#define MAX_CHARS 95
#define CHAR_OFFSET 0x20

const uint8_t font[] PROGMEM = {
  // 5 chars bitmap, stop bit is bit.7
0x00,0x00,0x00,0x00,0x80,      // 0x20, 32, '
0x00,0x30,0x7D,0x30,0x80,      // 0x21, 33, !
0x70,0x60,0x00,0x70,0xE0,      // 0x22, 34, "
0x12,0x3F,0x12,0x3F,0x92,      // 0x23, 35, #
0x12,0x6A,0x2B,0xA4,0x80,      // 0x24, 36, $
0x63,0x64,0x08,0x13,0xE3,      // 0x25, 37, %
0x36,0x49,0x35,0x02,0x85,      // 0x26, 38, &
0x00,0x70,0x60,0x80,0x80,      // 0x27, 39, '
0x00,0x3E,0x41,0x80,0x80,      // 0x28, 40, (
0x00,0x41,0x3E,0x80,0x80,      // 0x29, 41, )
0x08,0x3E,0x1C,0x3E,0x88,      // 0x2A, 42, *
0x08,0x08,0x3E,0x08,0x88,      // 0x2B, 43, +
0x00,0x03,0x03,0x80,0x80,      // 0x2C, 44, ,
0x08,0x08,0x08,0x08,0x88,      // 0x2D, 45, -
0x00,0x03,0x03,0x80,0x80,      // 0x2E, 46, .
0x02,0x04,0x08,0x10,0xA0,      // 0x2F, 47, /
0x3E,0x45,0x49,0x51,0xBE,      // 0x30, 48, 0
0x00,0x21,0x7F,0x81,0x80,      // 0x31, 49, 1
0x23,0x45,0x49,0x49,0xB1,      // 0x32, 50, 2
0x22,0x49,0x49,0x49,0xB6,      // 0x33, 51, 3
0xC,0x14,0x24,0x7F,0x84,       // 0x34, 52, 4
0x7A,0x49,0x49,0x49,0xC6,      // 0x35, 53, 5
0x1E,0x29,0x49,0x49,0x86,      // 0x36, 54, 6
0x40,0x47,0x48,0x50,0xE0,      // 0x37, 55, 7
0x36,0x49,0x49,0x49,0xB6,      // 0x38, 56, 8
0x30,0x49,0x49,0x4A,0xBC,      // 0x39, 57, 9
0x00,0x1B,0x1B,0x80,0x80,      // 0x3A, 58, :
0x00,0x1B,0x1B,0x80,0x80,      // 0x3B, 59, ;
0x08,0x14,0x22,0xC1,0x80,      // 0x3C, 60, <
0x12,0x12,0x12,0x12,0x92,      // 0x3D, 61, =
0x00,0x41,0x22,0x14,0x88,      // 0x3E, 62, >
0x20,0x40,0x4D,0x48,0xB0,      // 0x3F, 63, ?
0x3E,0x41,0x5D,0x55,0xBC,      // 0x40, 64, @
0x3F,0x44,0x44,0x44,0xBF,      // 0x41, 65, A
0x7F,0x49,0x49,0x49,0xB6,      // 0x42, 66, B
0x3E,0x41,0x41,0x41,0xA2,      // 0x43, 67, C
0x7F,0x41,0x41,0x41,0xBE,      // 0x44, 68, D
0x7F,0x49,0x49,0x49,0xC1,      // 0x45, 69, E
0x7F,0x48,0x48,0x48,0xC0,      // 0x46, 70, F
0x3E,0x41,0x49,0x49,0xAF,      // 0x47, 71, G
0x7F,0x08,0x08,0x08,0xFF,      // 0x48, 72, H
0x00,0x41,0x7F,0xC1,0x80,      // 0x49, 73, I
0x06,0x01,0x01,0x01,0xFE,      // 0x4A, 74, J
0x7F,0x08,0x14,0x22,0xC1,      // 0x4B, 75, K
0x7F,0x01,0x01,0x01,0x81,      // 0x4C, 76, L
0x7F,0x20,0x10,0x20,0xFF,      // 0x4D, 77, M
0x7F,0x20,0x10,0x08,0xFF,      // 0x4E, 78, N
0x3E,0x41,0x41,0x41,0xBE,      // 0x4F, 79, O
0x7F,0x48,0x48,0x48,0xB0,      // 0x50, 80, P
0x3E,0x41,0x45,0x42,0xBD,      // 0x51, 81, Q
0x7F,0x48,0x48,0x4C,0xB3,      // 0x52, 82, R
0x32,0x49,0x49,0x49,0xA6,      // 0x53, 83, S
0x40,0x40,0x7F,0x40,0xC0,      // 0x54, 84, T
0x7E,0x01,0x01,0x01,0xFE,      // 0x55, 85, U
0x7C,0x02,0x01,0x02,0xFC,      // 0x56, 86, V
0x7E,0x01,0x1E,0x01,0xFE,      // 0x57, 87, W
0x63,0x14,0x08,0x14,0xE3,      // 0x58, 88, X
0x70,0x08,0x07,0x08,0xF0,      // 0x59, 89, Y
0x47,0x49,0x51,0xE1,0x80,      // 0x5A, 90, Z
0x00,0x7F,0x41,0x41,0x80,     //0x5B, 91,
0x20,0x10,0x08,0x04,0x82,     //0x5C, 92,
0x00,0x00,0x41,0x7F,0x80,     //0x5D, 93,
0x00,0x20,0x40,0x20,0x80,     //0x5E, 94,^
0x01,0x01,0x01,0x01,0x81,     //0x5F, 95,_
0x00,0x40,0x20,0x00,0x80,     //0x60, 96,`
0x0E,0x11,0x11,0x12,0x9F,     //0x61, 97,a
0x7F,0x09,0x09,0x06,0x80,    //0x62, 98,b
0x0E,0x11,0x11,0x11,0x8A,     //0x63, 99,c
0x0E,0x11,0x11,0x12,0xFF,     //0x64, 100,d
0x0E,0x15,0x15,0x15,0x89,     //0x65, 101,e
0x04,0x3F,0x44,0x40,0xA0,     //0x66, 102,f
0x00,0x32,0x49,0x49,0xBE,     //0x67, 103,g
0x7F,0x08,0x08,0x07,0x80,     //0x62, 104,h
0x00,0x09,0x2F,0x01,0x80,     //0x69, 105,i
0x02,0x11,0x5E,0x10,0x80,     //0x6A, 106,j
0x7F,0x04,0x0A,0x11,0x80,     //0x6B, 107,k
0x00,0x41,0x7F,0x01,0x80,     //0x6C, 108,l
0x0F,0x10,0x0C,0x10,0x8F,     //0x6D, 109,m
0x0F,0x10,0x10,0x10,0x8F,     //0x6E, 110,n
0x0E,0x11,0x11,0x11,0x8E,     //0x6F, 111,o
0x00,0x7F,0x48,0x48,0xB0,     //0x70, 112,p
0x30,0x48,0x48,0x3F,0x81,     //0x71, 113,q
0x1F,0x08,0x10,0x10,0x88,     //0x72, 114,r
0x0A,0x19,0x15,0x13,0x8A,     //0x73, 115,s
0x08,0x7E,0x09,0x02,0x80,     //0x74, 116,t
0x1E,0x01,0x01,0x02,0x9F,     //0x75, 117,u
0x18,0x06,0x01,0x06,0x98,     //0x76, 118,v
0x1E,0x01,0x02,0x01,0x9E,     //0x77, 119,w
0x11,0x0A,0x04,0x0A,0x91,     //0x78, 120,x
0x00,0x72,0x09,0x09,0xFE,     //0x79, 121,y
0x00,0x11,0x13,0x15,0x99,     //0x7A, 122,z
0x08,0x2A,0x55,0x41,0x80,     //0x7B, 123,{
0x00,0x00,0x7F,0x00,0x80,     //0x7C, 124,|
0x00,0x41,0x5D,0x2A,0x88,     //0x7D, 125,}
0x08,0x10,0x08,0x10,0x80,     //0x7E, 126,~







};

#endif /*FONT_H_*/
5  Using Arduino / LEDs and Multiplexing / max7219 expert needed 8x64 matrix on: February 27, 2012, 02:38:26 pm
okay so i need help with my code i was able to extend my code onto 8 matrices but i can figure out how to stop it from scrolling i just want it to display a stationary word across the matrices i originally got the code from http://arduino.cc/forum/index.php/topic,22305.0.html and built from there can some one help me understand how to fix this code to a stationary display here is my code for an 8 x 64 matrix and my font library.

Code:
//We always have to include the library
#include "LedControl.h"
#include "font.h"
#include <avr/pgmspace.h>

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,8);

void setup() {
  //we have already set the number of devices when we created the LedControl
  int devices=lc.getDeviceCount();
  //we have to init all devices in a loop
  for(int address=0;address<devices;address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address,false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address,8);
    /* and clear the display */
    lc.clearDisplay(address);
  }



}

// Change these values to adjust scroll speeds and animation iterations

#define TEXT_SCROLL_SPEED 1     // how fast to scrill the text (wait)

#define REPEAT_TEXT 1              // how often to repeat the text if in cycling mode

// How to add a new message:
// * add the new message (only upper case, see font.h)
// * adjust MAX_MESSAGES
// * add the new message to messages
// NOTE: messages may not be longer than 255 chars.
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193587488
// Since 0012, PGM_P is broken. Fortunately there's a workaround

char message_00[] PROGMEM = "ABCDEFGHIJ";
char message_01[] PROGMEM = "";
char message_02[] PROGMEM = "";

#define MAX_MESSAGES 1
//PGM_P PROGMEM messages[] = {
PROGMEM const char *messages[] = { 
    message_00
//    ,message_01
//    ,message_02
};

uint8_t screen_mem[64];                  // screen memory
uint8_t active_row=1;                  // active row
uint8_t message_ptr = 0;                 // points to the active char in the message
uint8_t message_displayed = 0;           // how often has the message been displayed?
uint8_t active_char = 0;                 // stores the active char
uint8_t message_length = 0;              // stores the length of the active message
uint8_t char_ptr = 0;                    // points to the active col in the char
uint8_t char_length = 0;                 // stores the length of the active char
/*
 * copy screen_mem[] to LED Matrix 8x8
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  int i;
  for (i=0; i<8; i++){
    lc.setColumn(7,i,screen_mem[i+56]);
    lc.setColumn(6,i,screen_mem[i+48]);
    lc.setColumn(5,i,screen_mem[i+40]);
    lc.setColumn(4,i,screen_mem[i+32]);
    lc.setColumn(3,i,screen_mem[i+24]);
    lc.setColumn(2,i,screen_mem[i+16]); 
    lc.setColumn(1,i,screen_mem[i+8]);
    lc.setColumn(0,i,screen_mem[i]) ;
}
}
/*
 * show_char
 * Displays the actual message.
 * Scrolls the screen to the left and draws new pixels on the right.
 * char stop bit is bit.7
 */
void show_char(const prog_uint8_t string[]) {
  uint8_t i;
  uint8_t b;

 // shift the screen to the left
  for (i = 0; i < 63; i++) {
    screen_mem[i] = screen_mem[i+1];
 }
  // advance a char if needed
  if (char_length == 0x80) {

   char_length =0;      //reset stop bit

    //read next char from progmem
    memcpy_P(&active_char,&string[message_ptr],1);
    //this is an alternativ PROGMEM access:
    //active_char =  pgm_read_byte_near(string + message_ptr);
    message_ptr++;

    //string stop byte 0x00
    if (active_char == 0) {
      message_ptr = 0;
      message_displayed++;
      char_length =0x80; // immediately read next char
    }

    active_char -= CHAR_OFFSET;
    char_ptr = 0;

    // this makes the space between two chars
    screen_mem[63]=0;
    return;
  }

  // read pixels for current column of char
  b = pgm_read_byte(&font[active_char * 5 + char_ptr]);
  char_ptr++;
  //char_length= (b & 0x01);
  //b = (b >> 1);
  char_length= (b & 0x80);
  b = (b & 0x7F);
  // write pixels into screen memory
  screen_mem[63] =b;
  Serial.print((uint16_t)active_char); Serial.print(" / "); Serial.println(char_ptr, HEX);
}


/*
 * copy_to_buffer
 * Copies the given sprite from PROGMEM to 8x8 LED RAM.
 */
void copy_to_buffer(const prog_uint8_t sprite[8]) {
  memcpy_P(screen_mem, sprite, 8);
}




void loop() {
 
  int devices=lc.getDeviceCount();
  int8_t i,j,k;

  while (1) {
 
   
   
      writeArduinoOnMatrix();
      delay(TEXT_SCROLL_SPEED);
   

   

    //6
    for (i = 0; i < MAX_MESSAGES; i++) {
      message_displayed = 0;
      while (message_displayed < REPEAT_TEXT) {
        show_char((uint8_t*)pgm_read_word(&(messages)));  //show_char((prog_uint8_t*)pgm_read_word(&(messages[i])));
        writeArduinoOnMatrix();
        delay(TEXT_SCROLL_SPEED);
      }
    }



  }

}
6  Using Arduino / Programming Questions / Re: convert scrolling matrix to non scroling help! on: February 27, 2012, 11:17:51 am
when i remove that code no letters are displayed at all
7  Using Arduino / LEDs and Multiplexing / Re: max7219 led matrix scrolling to stationary help!! on: February 23, 2012, 05:13:02 pm
here is the font.h library

Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

#ifndef FONT_H_
#define FONT_H_

#define MAX_CHARS 95
#define CHAR_OFFSET 0x20

const uint8_t font[] PROGMEM = {
  // 5 chars bitmap, stop bit is bit.7
0x00,0x00,0x00,0x00,0x80,      // 0x20, 32, '
0x00,0x30,0x7D,0x30,0x80,      // 0x21, 33, !
0x70,0x60,0x00,0x70,0xE0,      // 0x22, 34, "
0x12,0x3F,0x12,0x3F,0x92,      // 0x23, 35, #
0x12,0x6A,0x2B,0xA4,0x80,      // 0x24, 36, $
0x63,0x64,0x08,0x13,0xE3,      // 0x25, 37, %
0x36,0x49,0x35,0x02,0x85,      // 0x26, 38, &
0x00,0x70,0x60,0x80,0x80,      // 0x27, 39, '
0x00,0x3E,0x41,0x80,0x80,      // 0x28, 40, (
0x00,0x41,0x3E,0x80,0x80,      // 0x29, 41, )
0x08,0x3E,0x1C,0x3E,0x88,      // 0x2A, 42, *
0x08,0x08,0x3E,0x08,0x88,      // 0x2B, 43, +
0x00,0x03,0x03,0x80,0x80,      // 0x2C, 44, ,
0x08,0x08,0x08,0x08,0x88,      // 0x2D, 45, -
0x00,0x03,0x03,0x80,0x80,      // 0x2E, 46, .
0x02,0x04,0x08,0x10,0xA0,      // 0x2F, 47, /
0x3E,0x45,0x49,0x51,0xBE,      // 0x30, 48, 0
0x00,0x21,0x7F,0x81,0x80,      // 0x31, 49, 1
0x23,0x45,0x49,0x49,0xB1,      // 0x32, 50, 2
0x22,0x49,0x49,0x49,0xB6,      // 0x33, 51, 3
0xC,0x14,0x24,0x7F,0x84,       // 0x34, 52, 4
0x7A,0x49,0x49,0x49,0xC6,      // 0x35, 53, 5
0x1E,0x29,0x49,0x49,0x86,      // 0x36, 54, 6
0x40,0x47,0x48,0x50,0xE0,      // 0x37, 55, 7
0x36,0x49,0x49,0x49,0xB6,      // 0x38, 56, 8
0x30,0x49,0x49,0x4A,0xBC,      // 0x39, 57, 9
0x00,0x1B,0x1B,0x80,0x80,      // 0x3A, 58, :
0x00,0x1B,0x1B,0x80,0x80,      // 0x3B, 59, ;
0x08,0x14,0x22,0xC1,0x80,      // 0x3C, 60, <
0x12,0x12,0x12,0x12,0x92,      // 0x3D, 61, =
0x00,0x41,0x22,0x14,0x88,      // 0x3E, 62, >
0x20,0x40,0x4D,0x48,0xB0,      // 0x3F, 63, ?
0x3E,0x41,0x5D,0x55,0xBC,      // 0x40, 64, @
0x3F,0x44,0x44,0x44,0xBF,      // 0x41, 65, A
0x7F,0x49,0x49,0x49,0xB6,      // 0x42, 66, B
0x3E,0x41,0x41,0x41,0xA2,      // 0x43, 67, C
0x7F,0x41,0x41,0x41,0xBE,      // 0x44, 68, D
0x7F,0x49,0x49,0x49,0xC1,      // 0x45, 69, E
0x7F,0x48,0x48,0x48,0xC0,      // 0x46, 70, F
0x3E,0x41,0x49,0x49,0xAF,      // 0x47, 71, G
0x7F,0x08,0x08,0x08,0xFF,      // 0x48, 72, H
0x00,0x41,0x7F,0xC1,0x80,      // 0x49, 73, I
0x06,0x01,0x01,0x01,0xFE,      // 0x4A, 74, J
0x7F,0x08,0x14,0x22,0xC1,      // 0x4B, 75, K
0x7F,0x01,0x01,0x01,0x81,      // 0x4C, 76, L
0x7F,0x20,0x10,0x20,0xFF,      // 0x4D, 77, M
0x7F,0x20,0x10,0x08,0xFF,      // 0x4E, 78, N
0x3E,0x41,0x41,0x41,0xBE,      // 0x4F, 79, O
0x7F,0x48,0x48,0x48,0xB0,      // 0x50, 80, P
0x3E,0x41,0x45,0x42,0xBD,      // 0x51, 81, Q
0x7F,0x48,0x48,0x4C,0xB3,      // 0x52, 82, R
0x32,0x49,0x49,0x49,0xA6,      // 0x53, 83, S
0x40,0x40,0x7F,0x40,0xC0,      // 0x54, 84, T
0x7E,0x01,0x01,0x01,0xFE,      // 0x55, 85, U
0x7C,0x02,0x01,0x02,0xFC,      // 0x56, 86, V
0x7E,0x01,0x1E,0x01,0xFE,      // 0x57, 87, W
0x63,0x14,0x08,0x14,0xE3,      // 0x58, 88, X
0x70,0x08,0x07,0x08,0xF0,      // 0x59, 89, Y
0x47,0x49,0x51,0xE1,0x80,      // 0x5A, 90, Z
0x00,0x7F,0x41,0x41,0x80,     //0x5B, 91,
0x20,0x10,0x08,0x04,0x82,     //0x5C, 92,
0x00,0x00,0x41,0x7F,0x80,     //0x5D, 93,
0x00,0x20,0x40,0x20,0x80,     //0x5E, 94,^
0x01,0x01,0x01,0x01,0x81,     //0x5F, 95,_
0x00,0x40,0x20,0x00,0x80,     //0x60, 96,`
0x0E,0x11,0x11,0x12,0x9F,     //0x61, 97,a
0x7F,0x09,0x09,0x06,0x80,    //0x62, 98,b
0x0E,0x11,0x11,0x11,0x8A,     //0x63, 99,c
0x0E,0x11,0x11,0x12,0xFF,     //0x64, 100,d
0x0E,0x15,0x15,0x15,0x89,     //0x65, 101,e
0x04,0x3F,0x44,0x40,0xA0,     //0x66, 102,f
0x00,0x32,0x49,0x49,0xBE,     //0x67, 103,g
0x7F,0x08,0x08,0x07,0x80,     //0x62, 104,h
0x00,0x09,0x2F,0x01,0x80,     //0x69, 105,i
0x02,0x11,0x5E,0x10,0x80,     //0x6A, 106,j
0x7F,0x04,0x0A,0x11,0x80,     //0x6B, 107,k
0x00,0x41,0x7F,0x01,0x80,     //0x6C, 108,l
0x0F,0x10,0x0C,0x10,0x8F,     //0x6D, 109,m
0x0F,0x10,0x10,0x10,0x8F,     //0x6E, 110,n
0x0E,0x11,0x11,0x11,0x8E,     //0x6F, 111,o
0x00,0x7F,0x48,0x48,0xB0,     //0x70, 112,p
0x30,0x48,0x48,0x3F,0x81,     //0x71, 113,q
0x1F,0x08,0x10,0x10,0x88,     //0x72, 114,r
0x0A,0x19,0x15,0x13,0x8A,     //0x73, 115,s
0x08,0x7E,0x09,0x02,0x80,     //0x74, 116,t
0x1E,0x01,0x01,0x02,0x9F,     //0x75, 117,u
0x18,0x06,0x01,0x06,0x98,     //0x76, 118,v
0x1E,0x01,0x02,0x01,0x9E,     //0x77, 119,w
0x11,0x0A,0x04,0x0A,0x91,     //0x78, 120,x
0x00,0x72,0x09,0x09,0xFE,     //0x79, 121,y
0x00,0x11,0x13,0x15,0x99,     //0x7A, 122,z
0x08,0x2A,0x55,0x41,0x80,     //0x7B, 123,{
0x00,0x00,0x7F,0x00,0x80,     //0x7C, 124,|
0x00,0x41,0x5D,0x2A,0x88,     //0x7D, 125,}
0x08,0x10,0x08,0x10,0x80,     //0x7E, 126,~







};

#endif /*FONT_H_*/
8  Using Arduino / LEDs and Multiplexing / max7219 led matrix scrolling to stationary help!! on: February 23, 2012, 05:11:57 pm
okay so i need help with my code i was able to extend my code onto 8 matrices but i can figure out how to stop it from scrolling i just want it to display a stationary word across the matrices i originally got the code from http://arduino.cc/forum/index.php/topic,22305.0.html and built from there can some one help me understand how to fix this code to a stationary display here is my code for an 8 x 64 matrix and my font library.

Code:
//We always have to include the library
#include "LedControl.h"
#include "font.h"
#include <avr/pgmspace.h>

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,8);

void setup() {
  //we have already set the number of devices when we created the LedControl
  int devices=lc.getDeviceCount();
  //we have to init all devices in a loop
  for(int address=0;address<devices;address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address,false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address,8);
    /* and clear the display */
    lc.clearDisplay(address);
  }



}

// Change these values to adjust scroll speeds and animation iterations

#define TEXT_SCROLL_SPEED 1     // how fast to scrill the text (wait)

#define REPEAT_TEXT 1              // how often to repeat the text if in cycling mode

// How to add a new message:
// * add the new message (only upper case, see font.h)
// * adjust MAX_MESSAGES
// * add the new message to messages
// NOTE: messages may not be longer than 255 chars.
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193587488
// Since 0012, PGM_P is broken. Fortunately there's a workaround

char message_00[] PROGMEM = "ABCDEFGHIJ";
char message_01[] PROGMEM = "";
char message_02[] PROGMEM = "";

#define MAX_MESSAGES 1
//PGM_P PROGMEM messages[] = {
PROGMEM const char *messages[] = { 
    message_00
//    ,message_01
//    ,message_02
};

uint8_t screen_mem[64];                  // screen memory
uint8_t active_row=1;                  // active row
uint8_t message_ptr = 0;                 // points to the active char in the message
uint8_t message_displayed = 0;           // how often has the message been displayed?
uint8_t active_char = 0;                 // stores the active char
uint8_t message_length = 0;              // stores the length of the active message
uint8_t char_ptr = 0;                    // points to the active col in the char
uint8_t char_length = 0;                 // stores the length of the active char
/*
 * copy screen_mem[] to LED Matrix 8x8
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  int i;
  for (i=0; i<8; i++){
    lc.setColumn(7,i,screen_mem[i+56]);
    lc.setColumn(6,i,screen_mem[i+48]);
    lc.setColumn(5,i,screen_mem[i+40]);
    lc.setColumn(4,i,screen_mem[i+32]);
    lc.setColumn(3,i,screen_mem[i+24]);
    lc.setColumn(2,i,screen_mem[i+16]); 
    lc.setColumn(1,i,screen_mem[i+8]);
    lc.setColumn(0,i,screen_mem[i]) ;
}
}
/*
 * show_char
 * Displays the actual message.
 * Scrolls the screen to the left and draws new pixels on the right.
 * char stop bit is bit.7
 */
void show_char(const prog_uint8_t string[]) {
  uint8_t i;
  uint8_t b;

 // shift the screen to the left
  for (i = 0; i < 63; i++) {
    screen_mem[i] = screen_mem[i+1];
 }
  // advance a char if needed
  if (char_length == 0x80) {

   char_length =0;      //reset stop bit

    //read next char from progmem
    memcpy_P(&active_char,&string[message_ptr],1);
    //this is an alternativ PROGMEM access:
    //active_char =  pgm_read_byte_near(string + message_ptr);
    message_ptr++;

    //string stop byte 0x00
    if (active_char == 0) {
      message_ptr = 0;
      message_displayed++;
      char_length =0x80; // immediately read next char
    }

    active_char -= CHAR_OFFSET;
    char_ptr = 0;

    // this makes the space between two chars
    screen_mem[63]=0;
    return;
  }

  // read pixels for current column of char
  b = pgm_read_byte(&font[active_char * 5 + char_ptr]);
  char_ptr++;
  //char_length= (b & 0x01);
  //b = (b >> 1);
  char_length= (b & 0x80);
  b = (b & 0x7F);
  // write pixels into screen memory
  screen_mem[63] =b;
  Serial.print((uint16_t)active_char); Serial.print(" / "); Serial.println(char_ptr, HEX);
}


/*
 * copy_to_buffer
 * Copies the given sprite from PROGMEM to 8x8 LED RAM.
 */
void copy_to_buffer(const prog_uint8_t sprite[8]) {
  memcpy_P(screen_mem, sprite, 8);
}




void loop() {
 
  int devices=lc.getDeviceCount();
  int8_t i,j,k;

  while (1) {
 
   
   
      writeArduinoOnMatrix();
      delay(TEXT_SCROLL_SPEED);
   

   

    //6
    for (i = 0; i < MAX_MESSAGES; i++) {
      message_displayed = 0;
      while (message_displayed < REPEAT_TEXT) {
        show_char((uint8_t*)pgm_read_word(&(messages)));  //show_char((prog_uint8_t*)pgm_read_word(&(messages[i])));
        writeArduinoOnMatrix();
        delay(TEXT_SCROLL_SPEED);
      }
    }



  }

}
9  Using Arduino / Project Guidance / Re: max7219 led matrix scrolling to stationary help on: February 23, 2012, 05:08:47 pm
here is the font.h library

Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

#ifndef FONT_H_
#define FONT_H_

#define MAX_CHARS 95
#define CHAR_OFFSET 0x20

const uint8_t font[] PROGMEM = {
  // 5 chars bitmap, stop bit is bit.7
0x00,0x00,0x00,0x00,0x80,      // 0x20, 32, '
0x00,0x30,0x7D,0x30,0x80,      // 0x21, 33, !
0x70,0x60,0x00,0x70,0xE0,      // 0x22, 34, "
0x12,0x3F,0x12,0x3F,0x92,      // 0x23, 35, #
0x12,0x6A,0x2B,0xA4,0x80,      // 0x24, 36, $
0x63,0x64,0x08,0x13,0xE3,      // 0x25, 37, %
0x36,0x49,0x35,0x02,0x85,      // 0x26, 38, &
0x00,0x70,0x60,0x80,0x80,      // 0x27, 39, '
0x00,0x3E,0x41,0x80,0x80,      // 0x28, 40, (
0x00,0x41,0x3E,0x80,0x80,      // 0x29, 41, )
0x08,0x3E,0x1C,0x3E,0x88,      // 0x2A, 42, *
0x08,0x08,0x3E,0x08,0x88,      // 0x2B, 43, +
0x00,0x03,0x03,0x80,0x80,      // 0x2C, 44, ,
0x08,0x08,0x08,0x08,0x88,      // 0x2D, 45, -
0x00,0x03,0x03,0x80,0x80,      // 0x2E, 46, .
0x02,0x04,0x08,0x10,0xA0,      // 0x2F, 47, /
0x3E,0x45,0x49,0x51,0xBE,      // 0x30, 48, 0
0x00,0x21,0x7F,0x81,0x80,      // 0x31, 49, 1
0x23,0x45,0x49,0x49,0xB1,      // 0x32, 50, 2
0x22,0x49,0x49,0x49,0xB6,      // 0x33, 51, 3
0xC,0x14,0x24,0x7F,0x84,       // 0x34, 52, 4
0x7A,0x49,0x49,0x49,0xC6,      // 0x35, 53, 5
0x1E,0x29,0x49,0x49,0x86,      // 0x36, 54, 6
0x40,0x47,0x48,0x50,0xE0,      // 0x37, 55, 7
0x36,0x49,0x49,0x49,0xB6,      // 0x38, 56, 8
0x30,0x49,0x49,0x4A,0xBC,      // 0x39, 57, 9
0x00,0x1B,0x1B,0x80,0x80,      // 0x3A, 58, :
0x00,0x1B,0x1B,0x80,0x80,      // 0x3B, 59, ;
0x08,0x14,0x22,0xC1,0x80,      // 0x3C, 60, <
0x12,0x12,0x12,0x12,0x92,      // 0x3D, 61, =
0x00,0x41,0x22,0x14,0x88,      // 0x3E, 62, >
0x20,0x40,0x4D,0x48,0xB0,      // 0x3F, 63, ?
0x3E,0x41,0x5D,0x55,0xBC,      // 0x40, 64, @
0x3F,0x44,0x44,0x44,0xBF,      // 0x41, 65, A
0x7F,0x49,0x49,0x49,0xB6,      // 0x42, 66, B
0x3E,0x41,0x41,0x41,0xA2,      // 0x43, 67, C
0x7F,0x41,0x41,0x41,0xBE,      // 0x44, 68, D
0x7F,0x49,0x49,0x49,0xC1,      // 0x45, 69, E
0x7F,0x48,0x48,0x48,0xC0,      // 0x46, 70, F
0x3E,0x41,0x49,0x49,0xAF,      // 0x47, 71, G
0x7F,0x08,0x08,0x08,0xFF,      // 0x48, 72, H
0x00,0x41,0x7F,0xC1,0x80,      // 0x49, 73, I
0x06,0x01,0x01,0x01,0xFE,      // 0x4A, 74, J
0x7F,0x08,0x14,0x22,0xC1,      // 0x4B, 75, K
0x7F,0x01,0x01,0x01,0x81,      // 0x4C, 76, L
0x7F,0x20,0x10,0x20,0xFF,      // 0x4D, 77, M
0x7F,0x20,0x10,0x08,0xFF,      // 0x4E, 78, N
0x3E,0x41,0x41,0x41,0xBE,      // 0x4F, 79, O
0x7F,0x48,0x48,0x48,0xB0,      // 0x50, 80, P
0x3E,0x41,0x45,0x42,0xBD,      // 0x51, 81, Q
0x7F,0x48,0x48,0x4C,0xB3,      // 0x52, 82, R
0x32,0x49,0x49,0x49,0xA6,      // 0x53, 83, S
0x40,0x40,0x7F,0x40,0xC0,      // 0x54, 84, T
0x7E,0x01,0x01,0x01,0xFE,      // 0x55, 85, U
0x7C,0x02,0x01,0x02,0xFC,      // 0x56, 86, V
0x7E,0x01,0x1E,0x01,0xFE,      // 0x57, 87, W
0x63,0x14,0x08,0x14,0xE3,      // 0x58, 88, X
0x70,0x08,0x07,0x08,0xF0,      // 0x59, 89, Y
0x47,0x49,0x51,0xE1,0x80,      // 0x5A, 90, Z
0x00,0x7F,0x41,0x41,0x80,     //0x5B, 91,
0x20,0x10,0x08,0x04,0x82,     //0x5C, 92,
0x00,0x00,0x41,0x7F,0x80,     //0x5D, 93,
0x00,0x20,0x40,0x20,0x80,     //0x5E, 94,^
0x01,0x01,0x01,0x01,0x81,     //0x5F, 95,_
0x00,0x40,0x20,0x00,0x80,     //0x60, 96,`
0x0E,0x11,0x11,0x12,0x9F,     //0x61, 97,a
0x7F,0x09,0x09,0x06,0x80,    //0x62, 98,b
0x0E,0x11,0x11,0x11,0x8A,     //0x63, 99,c
0x0E,0x11,0x11,0x12,0xFF,     //0x64, 100,d
0x0E,0x15,0x15,0x15,0x89,     //0x65, 101,e
0x04,0x3F,0x44,0x40,0xA0,     //0x66, 102,f
0x00,0x32,0x49,0x49,0xBE,     //0x67, 103,g
0x7F,0x08,0x08,0x07,0x80,     //0x62, 104,h
0x00,0x09,0x2F,0x01,0x80,     //0x69, 105,i
0x02,0x11,0x5E,0x10,0x80,     //0x6A, 106,j
0x7F,0x04,0x0A,0x11,0x80,     //0x6B, 107,k
0x00,0x41,0x7F,0x01,0x80,     //0x6C, 108,l
0x0F,0x10,0x0C,0x10,0x8F,     //0x6D, 109,m
0x0F,0x10,0x10,0x10,0x8F,     //0x6E, 110,n
0x0E,0x11,0x11,0x11,0x8E,     //0x6F, 111,o
0x00,0x7F,0x48,0x48,0xB0,     //0x70, 112,p
0x30,0x48,0x48,0x3F,0x81,     //0x71, 113,q
0x1F,0x08,0x10,0x10,0x88,     //0x72, 114,r
0x0A,0x19,0x15,0x13,0x8A,     //0x73, 115,s
0x08,0x7E,0x09,0x02,0x80,     //0x74, 116,t
0x1E,0x01,0x01,0x02,0x9F,     //0x75, 117,u
0x18,0x06,0x01,0x06,0x98,     //0x76, 118,v
0x1E,0x01,0x02,0x01,0x9E,     //0x77, 119,w
0x11,0x0A,0x04,0x0A,0x91,     //0x78, 120,x
0x00,0x72,0x09,0x09,0xFE,     //0x79, 121,y
0x00,0x11,0x13,0x15,0x99,     //0x7A, 122,z
0x08,0x2A,0x55,0x41,0x80,     //0x7B, 123,{
0x00,0x00,0x7F,0x00,0x80,     //0x7C, 124,|
0x00,0x41,0x5D,0x2A,0x88,     //0x7D, 125,}
0x08,0x10,0x08,0x10,0x80,     //0x7E, 126,~







};

#endif /*FONT_H_*/
10  Using Arduino / Project Guidance / max7219 led matrix scrolling to stationary help!! on: February 23, 2012, 05:07:48 pm
okay so i need help with my code i was able to extend my code onto 8 matrices but i can figure out how to stop it from scrolling i just want it to display a stationary word across the matrices i originally got the code from http://arduino.cc/forum/index.php/topic,22305.0.html and built from there can some one help me understand how to fix this code to a stationary display here is my code for an 8 x 64 matrix and my font library.

Code:
//We always have to include the library
#include "LedControl.h"
#include "font.h"
#include <avr/pgmspace.h>

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,8);

void setup() {
  //we have already set the number of devices when we created the LedControl
  int devices=lc.getDeviceCount();
  //we have to init all devices in a loop
  for(int address=0;address<devices;address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address,false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address,8);
    /* and clear the display */
    lc.clearDisplay(address);
  }



}

// Change these values to adjust scroll speeds and animation iterations

#define TEXT_SCROLL_SPEED 1     // how fast to scrill the text (wait)

#define REPEAT_TEXT 1              // how often to repeat the text if in cycling mode

// How to add a new message:
// * add the new message (only upper case, see font.h)
// * adjust MAX_MESSAGES
// * add the new message to messages
// NOTE: messages may not be longer than 255 chars.
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193587488
// Since 0012, PGM_P is broken. Fortunately there's a workaround

char message_00[] PROGMEM = "ABCDEFGHIJ";
char message_01[] PROGMEM = "";
char message_02[] PROGMEM = "";

#define MAX_MESSAGES 1
//PGM_P PROGMEM messages[] = {
PROGMEM const char *messages[] = {  
    message_00
//    ,message_01
//    ,message_02
};

uint8_t screen_mem[64];                  // screen memory
uint8_t active_row=1;                  // active row
uint8_t message_ptr = 0;                 // points to the active char in the message
uint8_t message_displayed = 0;           // how often has the message been displayed?
uint8_t active_char = 0;                 // stores the active char
uint8_t message_length = 0;              // stores the length of the active message
uint8_t char_ptr = 0;                    // points to the active col in the char
uint8_t char_length = 0;                 // stores the length of the active char
/*
 * copy screen_mem[] to LED Matrix 8x8
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  int i;
  for (i=0; i<8; i++){
    lc.setColumn(7,i,screen_mem[i+56]);
    lc.setColumn(6,i,screen_mem[i+48]);
    lc.setColumn(5,i,screen_mem[i+40]);
    lc.setColumn(4,i,screen_mem[i+32]);
    lc.setColumn(3,i,screen_mem[i+24]);
    lc.setColumn(2,i,screen_mem[i+16]);  
    lc.setColumn(1,i,screen_mem[i+8]);
    lc.setColumn(0,i,screen_mem[i]) ;
}
}
/*
 * show_char
 * Displays the actual message.
 * Scrolls the screen to the left and draws new pixels on the right.
 * char stop bit is bit.7
 */
void show_char(const prog_uint8_t string[]) {
  uint8_t i;
  uint8_t b;

 // shift the screen to the left
  for (i = 0; i < 63; i++) {
    screen_mem[i] = screen_mem[i+1];
 }
  // advance a char if needed
  if (char_length == 0x80) {

   char_length =0;      //reset stop bit

    //read next char from progmem
    memcpy_P(&active_char,&string[message_ptr],1);
    //this is an alternativ PROGMEM access:
    //active_char =  pgm_read_byte_near(string + message_ptr);
    message_ptr++;

    //string stop byte 0x00
    if (active_char == 0) {
      message_ptr = 0;
      message_displayed++;
      char_length =0x80; // immediately read next char
    }

    active_char -= CHAR_OFFSET;
    char_ptr = 0;

    // this makes the space between two chars
    screen_mem[63]=0;
    return;
  }

  // read pixels for current column of char
  b = pgm_read_byte(&font[active_char * 5 + char_ptr]);
  char_ptr++;
  //char_length= (b & 0x01);
  //b = (b >> 1);
  char_length= (b & 0x80);
  b = (b & 0x7F);
  // write pixels into screen memory
  screen_mem[63] =b;
  Serial.print((uint16_t)active_char); Serial.print(" / "); Serial.println(char_ptr, HEX);
}


/*
 * copy_to_buffer
 * Copies the given sprite from PROGMEM to 8x8 LED RAM.
 */
void copy_to_buffer(const prog_uint8_t sprite[8]) {
  memcpy_P(screen_mem, sprite, 8);
}




void loop() {
  
  int devices=lc.getDeviceCount();
  int8_t i,j,k;

  while (1) {
  
  
  
      writeArduinoOnMatrix();
      delay(TEXT_SCROLL_SPEED);
    

    

    //6
    for (i = 0; i < MAX_MESSAGES; i++) {
      message_displayed = 0;
      while (message_displayed < REPEAT_TEXT) {
        show_char((uint8_t*)pgm_read_word(&(messages)));  //show_char((prog_uint8_t*)pgm_read_word(&(messages[i])));
        writeArduinoOnMatrix();
        delay(TEXT_SCROLL_SPEED);
      }
    }



  }

}



11  Using Arduino / Programming Questions / Re: convert scrolling matrix to non scroling help! on: February 23, 2012, 04:54:25 pm
here is the font.h library


Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

#ifndef FONT_H_
#define FONT_H_

#define MAX_CHARS 95
#define CHAR_OFFSET 0x20

const uint8_t font[] PROGMEM = {
  // 5 chars bitmap, stop bit is bit.7
0x00,0x00,0x00,0x00,0x80,      // 0x20, 32, '
0x00,0x30,0x7D,0x30,0x80,      // 0x21, 33, !
0x70,0x60,0x00,0x70,0xE0,      // 0x22, 34, "
0x12,0x3F,0x12,0x3F,0x92,      // 0x23, 35, #
0x12,0x6A,0x2B,0xA4,0x80,      // 0x24, 36, $
0x63,0x64,0x08,0x13,0xE3,      // 0x25, 37, %
0x36,0x49,0x35,0x02,0x85,      // 0x26, 38, &
0x00,0x70,0x60,0x80,0x80,      // 0x27, 39, '
0x00,0x3E,0x41,0x80,0x80,      // 0x28, 40, (
0x00,0x41,0x3E,0x80,0x80,      // 0x29, 41, )
0x08,0x3E,0x1C,0x3E,0x88,      // 0x2A, 42, *
0x08,0x08,0x3E,0x08,0x88,      // 0x2B, 43, +
0x00,0x03,0x03,0x80,0x80,      // 0x2C, 44, ,
0x08,0x08,0x08,0x08,0x88,      // 0x2D, 45, -
0x00,0x03,0x03,0x80,0x80,      // 0x2E, 46, .
0x02,0x04,0x08,0x10,0xA0,      // 0x2F, 47, /
0x3E,0x45,0x49,0x51,0xBE,      // 0x30, 48, 0
0x00,0x21,0x7F,0x81,0x80,      // 0x31, 49, 1
0x23,0x45,0x49,0x49,0xB1,      // 0x32, 50, 2
0x22,0x49,0x49,0x49,0xB6,      // 0x33, 51, 3
0xC,0x14,0x24,0x7F,0x84,       // 0x34, 52, 4
0x7A,0x49,0x49,0x49,0xC6,      // 0x35, 53, 5
0x1E,0x29,0x49,0x49,0x86,      // 0x36, 54, 6
0x40,0x47,0x48,0x50,0xE0,      // 0x37, 55, 7
0x36,0x49,0x49,0x49,0xB6,      // 0x38, 56, 8
0x30,0x49,0x49,0x4A,0xBC,      // 0x39, 57, 9
0x00,0x1B,0x1B,0x80,0x80,      // 0x3A, 58, :
0x00,0x1B,0x1B,0x80,0x80,      // 0x3B, 59, ;
0x08,0x14,0x22,0xC1,0x80,      // 0x3C, 60, <
0x12,0x12,0x12,0x12,0x92,      // 0x3D, 61, =
0x00,0x41,0x22,0x14,0x88,      // 0x3E, 62, >
0x20,0x40,0x4D,0x48,0xB0,      // 0x3F, 63, ?
0x3E,0x41,0x5D,0x55,0xBC,      // 0x40, 64, @
0x3F,0x44,0x44,0x44,0xBF,      // 0x41, 65, A
0x7F,0x49,0x49,0x49,0xB6,      // 0x42, 66, B
0x3E,0x41,0x41,0x41,0xA2,      // 0x43, 67, C
0x7F,0x41,0x41,0x41,0xBE,      // 0x44, 68, D
0x7F,0x49,0x49,0x49,0xC1,      // 0x45, 69, E
0x7F,0x48,0x48,0x48,0xC0,      // 0x46, 70, F
0x3E,0x41,0x49,0x49,0xAF,      // 0x47, 71, G
0x7F,0x08,0x08,0x08,0xFF,      // 0x48, 72, H
0x00,0x41,0x7F,0xC1,0x80,      // 0x49, 73, I
0x06,0x01,0x01,0x01,0xFE,      // 0x4A, 74, J
0x7F,0x08,0x14,0x22,0xC1,      // 0x4B, 75, K
0x7F,0x01,0x01,0x01,0x81,      // 0x4C, 76, L
0x7F,0x20,0x10,0x20,0xFF,      // 0x4D, 77, M
0x7F,0x20,0x10,0x08,0xFF,      // 0x4E, 78, N
0x3E,0x41,0x41,0x41,0xBE,      // 0x4F, 79, O
0x7F,0x48,0x48,0x48,0xB0,      // 0x50, 80, P
0x3E,0x41,0x45,0x42,0xBD,      // 0x51, 81, Q
0x7F,0x48,0x48,0x4C,0xB3,      // 0x52, 82, R
0x32,0x49,0x49,0x49,0xA6,      // 0x53, 83, S
0x40,0x40,0x7F,0x40,0xC0,      // 0x54, 84, T
0x7E,0x01,0x01,0x01,0xFE,      // 0x55, 85, U
0x7C,0x02,0x01,0x02,0xFC,      // 0x56, 86, V
0x7E,0x01,0x1E,0x01,0xFE,      // 0x57, 87, W
0x63,0x14,0x08,0x14,0xE3,      // 0x58, 88, X
0x70,0x08,0x07,0x08,0xF0,      // 0x59, 89, Y
0x47,0x49,0x51,0xE1,0x80,      // 0x5A, 90, Z
0x00,0x7F,0x41,0x41,0x80,     //0x5B, 91,
0x20,0x10,0x08,0x04,0x82,     //0x5C, 92,
0x00,0x00,0x41,0x7F,0x80,     //0x5D, 93,
0x00,0x20,0x40,0x20,0x80,     //0x5E, 94,^
0x01,0x01,0x01,0x01,0x81,     //0x5F, 95,_
0x00,0x40,0x20,0x00,0x80,     //0x60, 96,`
0x0E,0x11,0x11,0x12,0x9F,     //0x61, 97,a
0x7F,0x09,0x09,0x06,0x80,    //0x62, 98,b
0x0E,0x11,0x11,0x11,0x8A,     //0x63, 99,c
0x0E,0x11,0x11,0x12,0xFF,     //0x64, 100,d
0x0E,0x15,0x15,0x15,0x89,     //0x65, 101,e
0x04,0x3F,0x44,0x40,0xA0,     //0x66, 102,f
0x00,0x32,0x49,0x49,0xBE,     //0x67, 103,g
0x7F,0x08,0x08,0x07,0x80,     //0x62, 104,h
0x00,0x09,0x2F,0x01,0x80,     //0x69, 105,i
0x02,0x11,0x5E,0x10,0x80,     //0x6A, 106,j
0x7F,0x04,0x0A,0x11,0x80,     //0x6B, 107,k
0x00,0x41,0x7F,0x01,0x80,     //0x6C, 108,l
0x0F,0x10,0x0C,0x10,0x8F,     //0x6D, 109,m
0x0F,0x10,0x10,0x10,0x8F,     //0x6E, 110,n
0x0E,0x11,0x11,0x11,0x8E,     //0x6F, 111,o
0x00,0x7F,0x48,0x48,0xB0,     //0x70, 112,p
0x30,0x48,0x48,0x3F,0x81,     //0x71, 113,q
0x1F,0x08,0x10,0x10,0x88,     //0x72, 114,r
0x0A,0x19,0x15,0x13,0x8A,     //0x73, 115,s
0x08,0x7E,0x09,0x02,0x80,     //0x74, 116,t
0x1E,0x01,0x01,0x02,0x9F,     //0x75, 117,u
0x18,0x06,0x01,0x06,0x98,     //0x76, 118,v
0x1E,0x01,0x02,0x01,0x9E,     //0x77, 119,w
0x11,0x0A,0x04,0x0A,0x91,     //0x78, 120,x
0x00,0x72,0x09,0x09,0xFE,     //0x79, 121,y
0x00,0x11,0x13,0x15,0x99,     //0x7A, 122,z
0x08,0x2A,0x55,0x41,0x80,     //0x7B, 123,{
0x00,0x00,0x7F,0x00,0x80,     //0x7C, 124,|
0x00,0x41,0x5D,0x2A,0x88,     //0x7D, 125,}
0x08,0x10,0x08,0x10,0x80,     //0x7E, 126,~







};

#endif /*FONT_H_*/
12  Using Arduino / Programming Questions / convert scrolling matrix to non scroling help! on: February 23, 2012, 04:53:40 pm
okay so i need help with my code i was able to extend my code onto 8 matrices but i can figure out how to stop it from scrolling i just want it to display a stationary word across the matrices i originally got the code from http://arduino.cc/forum/index.php/topic,22305.0.html and built from there can some one help me understand how to fix this code to a stationary display here is my code for an 8 x 64 matrix and my font library.

Code:
//We always have to include the library
#include "LedControl.h"
#include "font.h"
#include <avr/pgmspace.h>

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,8);

void setup() {
  //we have already set the number of devices when we created the LedControl
  int devices=lc.getDeviceCount();
  //we have to init all devices in a loop
  for(int address=0;address<devices;address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address,false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address,8);
    /* and clear the display */
    lc.clearDisplay(address);
  }



}

// Change these values to adjust scroll speeds and animation iterations

#define TEXT_SCROLL_SPEED 1     // how fast to scrill the text (wait)

#define REPEAT_TEXT 1              // how often to repeat the text if in cycling mode

// How to add a new message:
// * add the new message (only upper case, see font.h)
// * adjust MAX_MESSAGES
// * add the new message to messages
// NOTE: messages may not be longer than 255 chars.
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193587488
// Since 0012, PGM_P is broken. Fortunately there's a workaround

char message_00[] PROGMEM = "ABCDEFGHIJ";
char message_01[] PROGMEM = "";
char message_02[] PROGMEM = "";

#define MAX_MESSAGES 1
//PGM_P PROGMEM messages[] = {
PROGMEM const char *messages[] = { 
    message_00
//    ,message_01
//    ,message_02
};

uint8_t screen_mem[64];                  // screen memory
uint8_t active_row=1;                  // active row
uint8_t message_ptr = 0;                 // points to the active char in the message
uint8_t message_displayed = 0;           // how often has the message been displayed?
uint8_t active_char = 0;                 // stores the active char
uint8_t message_length = 0;              // stores the length of the active message
uint8_t char_ptr = 0;                    // points to the active col in the char
uint8_t char_length = 0;                 // stores the length of the active char
/*
 * copy screen_mem[] to LED Matrix 8x8
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  int i;
  for (i=0; i<8; i++){
    lc.setColumn(7,i,screen_mem[i+56]);
    lc.setColumn(6,i,screen_mem[i+48]);
    lc.setColumn(5,i,screen_mem[i+40]);
    lc.setColumn(4,i,screen_mem[i+32]);
    lc.setColumn(3,i,screen_mem[i+24]);
    lc.setColumn(2,i,screen_mem[i+16]); 
    lc.setColumn(1,i,screen_mem[i+8]);
    lc.setColumn(0,i,screen_mem[i]) ;
}
}
/*
 * show_char
 * Displays the actual message.
 * Scrolls the screen to the left and draws new pixels on the right.
 * char stop bit is bit.7
 */
void show_char(const prog_uint8_t string[]) {
  uint8_t i;
  uint8_t b;

 // shift the screen to the left
  for (i = 0; i < 63; i++) {
    screen_mem[i] = screen_mem[i+1];
 }
  // advance a char if needed
  if (char_length == 0x80) {

   char_length =0;      //reset stop bit

    //read next char from progmem
    memcpy_P(&active_char,&string[message_ptr],1);
    //this is an alternativ PROGMEM access:
    //active_char =  pgm_read_byte_near(string + message_ptr);
    message_ptr++;

    //string stop byte 0x00
    if (active_char == 0) {
      message_ptr = 0;
      message_displayed++;
      char_length =0x80; // immediately read next char
    }

    active_char -= CHAR_OFFSET;
    char_ptr = 0;

    // this makes the space between two chars
    screen_mem[63]=0;
    return;
  }

  // read pixels for current column of char
  b = pgm_read_byte(&font[active_char * 5 + char_ptr]);
  char_ptr++;
  //char_length= (b & 0x01);
  //b = (b >> 1);
  char_length= (b & 0x80);
  b = (b & 0x7F);
  // write pixels into screen memory
  screen_mem[63] =b;
  Serial.print((uint16_t)active_char); Serial.print(" / "); Serial.println(char_ptr, HEX);
}


/*
 * copy_to_buffer
 * Copies the given sprite from PROGMEM to 8x8 LED RAM.
 */
void copy_to_buffer(const prog_uint8_t sprite[8]) {
  memcpy_P(screen_mem, sprite, 8);
}




void loop() {
 
  int devices=lc.getDeviceCount();
  int8_t i,j,k;

  while (1) {
 
   
   
      writeArduinoOnMatrix();
      delay(TEXT_SCROLL_SPEED);
   

   

    //6
    for (i = 0; i < MAX_MESSAGES; i++) {
      message_displayed = 0;
      while (message_displayed < REPEAT_TEXT) {
        show_char((uint8_t*)pgm_read_word(&(messages)));  //show_char((prog_uint8_t*)pgm_read_word(&(messages[i])));
        writeArduinoOnMatrix();
        delay(TEXT_SCROLL_SPEED);
      }
    }



  }

}



13  Using Arduino / Programming Questions / Re: Scrolling Led Matrix Serial Help !! on: February 04, 2012, 03:17:04 am
the code i posted above will scroll a messege i put in the code i just want to find a way to include serial input here is the library i created for this also

 
Code:
#include <avr/io.h>
#include <avr/pgmspace.h>

#ifndef FONT_H_
#define FONT_H_

#define MAX_CHARS 95
#define CHAR_OFFSET 0x20

const uint8_t font[] PROGMEM = {
  // 5 chars bitmap, stop bit is bit.7
0x00,0x00,0x00,0x00,0x80,      // 0x20, 32, '
0x00,0x30,0x7D,0x30,0x80,      // 0x21, 33, !
0x70,0x60,0x00,0x70,0xE0,      // 0x22, 34, "
0x12,0x3F,0x12,0x3F,0x92,      // 0x23, 35, #
0x12,0x6A,0x2B,0xA4,0x80,      // 0x24, 36, $
0x63,0x64,0x08,0x13,0xE3,      // 0x25, 37, %
0x36,0x49,0x35,0x02,0x85,      // 0x26, 38, &
0x00,0x70,0x60,0x80,0x80,      // 0x27, 39, '
0x00,0x3E,0x41,0x80,0x80,      // 0x28, 40, (
0x00,0x41,0x3E,0x80,0x80,      // 0x29, 41, )
0x08,0x3E,0x1C,0x3E,0x88,      // 0x2A, 42, *
0x08,0x08,0x3E,0x08,0x88,      // 0x2B, 43, +
0x00,0x03,0x03,0x80,0x80,      // 0x2C, 44, ,
0x08,0x08,0x08,0x08,0x88,      // 0x2D, 45, -
0x00,0x03,0x03,0x80,0x80,      // 0x2E, 46, .
0x02,0x04,0x08,0x10,0xA0,      // 0x2F, 47, /
0x3E,0x45,0x49,0x51,0xBE,      // 0x30, 48, 0
0x00,0x21,0x7F,0x81,0x80,      // 0x31, 49, 1
0x23,0x45,0x49,0x49,0xB1,      // 0x32, 50, 2
0x22,0x49,0x49,0x49,0xB6,      // 0x33, 51, 3
0xC,0x14,0x24,0x7F,0x84,       // 0x34, 52, 4
0x7A,0x49,0x49,0x49,0xC6,      // 0x35, 53, 5
0x1E,0x29,0x49,0x49,0x86,      // 0x36, 54, 6
0x40,0x47,0x48,0x50,0xE0,      // 0x37, 55, 7
0x36,0x49,0x49,0x49,0xB6,      // 0x38, 56, 8
0x30,0x49,0x49,0x4A,0xBC,      // 0x39, 57, 9
0x00,0x1B,0x1B,0x80,0x80,      // 0x3A, 58, :
0x00,0x1B,0x1B,0x80,0x80,      // 0x3B, 59, ;
0x08,0x14,0x22,0xC1,0x80,      // 0x3C, 60, <
0x12,0x12,0x12,0x12,0x92,      // 0x3D, 61, =
0x00,0x41,0x22,0x14,0x88,      // 0x3E, 62, >
0x20,0x40,0x4D,0x48,0xB0,      // 0x3F, 63, ?
0x3E,0x41,0x5D,0x55,0xBC,      // 0x40, 64, @
0x3F,0x44,0x44,0x44,0xBF,      // 0x41, 65, A
0x7F,0x49,0x49,0x49,0xB6,      // 0x42, 66, B
0x3E,0x41,0x41,0x41,0xA2,      // 0x43, 67, C
0x7F,0x41,0x41,0x41,0xBE,      // 0x44, 68, D
0x7F,0x49,0x49,0x49,0xC1,      // 0x45, 69, E
0x7F,0x48,0x48,0x48,0xC0,      // 0x46, 70, F
0x3E,0x41,0x49,0x49,0xAF,      // 0x47, 71, G
0x7F,0x08,0x08,0x08,0xFF,      // 0x48, 72, H
0x00,0x41,0x7F,0xC1,0x80,      // 0x49, 73, I
0x06,0x01,0x01,0x01,0xFE,      // 0x4A, 74, J
0x7F,0x08,0x14,0x22,0xC1,      // 0x4B, 75, K
0x7F,0x01,0x01,0x01,0x81,      // 0x4C, 76, L
0x7F,0x20,0x10,0x20,0xFF,      // 0x4D, 77, M
0x7F,0x20,0x10,0x08,0xFF,      // 0x4E, 78, N
0x3E,0x41,0x41,0x41,0xBE,      // 0x4F, 79, O
0x7F,0x48,0x48,0x48,0xB0,      // 0x50, 80, P
0x3E,0x41,0x45,0x42,0xBD,      // 0x51, 81, Q
0x7F,0x48,0x48,0x4C,0xB3,      // 0x52, 82, R
0x32,0x49,0x49,0x49,0xA6,      // 0x53, 83, S
0x40,0x40,0x7F,0x40,0xC0,      // 0x54, 84, T
0x7E,0x01,0x01,0x01,0xFE,      // 0x55, 85, U
0x7C,0x02,0x01,0x02,0xFC,      // 0x56, 86, V
0x7E,0x01,0x1E,0x01,0xFE,      // 0x57, 87, W
0x63,0x14,0x08,0x14,0xE3,      // 0x58, 88, X
0x70,0x08,0x07,0x08,0xF0,      // 0x59, 89, Y
0x47,0x49,0x51,0xE1,0x80,      // 0x5A, 90, Z
0x00,0x7F,0x41,0x41,0x80,     //0x5B, 91,
0x20,0x10,0x08,0x04,0x82,     //0x5C, 92,
0x00,0x00,0x41,0x7F,0x80,     //0x5D, 93,
0x00,0x20,0x40,0x20,0x80,     //0x5E, 94,^
0x01,0x01,0x01,0x01,0x81,     //0x5F, 95,_
0x00,0x40,0x20,0x00,0x80,     //0x60, 96,`
0x0E,0x11,0x11,0x12,0x9F,     //0x61, 97,a
0x7F,0x09,0x09,0x06,0x80,    //0x62, 98,b
0x0E,0x11,0x11,0x11,0x8A,     //0x63, 99,c
0x0E,0x11,0x11,0x12,0xFF,     //0x64, 100,d
0x0E,0x15,0x15,0x15,0x89,     //0x65, 101,e
0x04,0x3F,0x44,0x40,0xA0,     //0x66, 102,f
0x00,0x32,0x49,0x49,0xBE,     //0x67, 103,g
0x7F,0x08,0x08,0x07,0x80,     //0x62, 104,h
0x00,0x09,0x2F,0x01,0x80,     //0x69, 105,i
0x02,0x11,0x5E,0x10,0x80,     //0x6A, 106,j
0x7F,0x04,0x0A,0x11,0x80,     //0x6B, 107,k
0x00,0x41,0x7F,0x01,0x80,     //0x6C, 108,l
0x0F,0x10,0x0C,0x10,0x8F,     //0x6D, 109,m
0x0F,0x10,0x10,0x10,0x8F,     //0x6E, 110,n
0x0E,0x11,0x11,0x11,0x8E,     //0x6F, 111,o
0x00,0x7F,0x48,0x48,0xB0,     //0x70, 112,p
0x30,0x48,0x48,0x3F,0x81,     //0x71, 113,q
0x1F,0x08,0x10,0x10,0x88,     //0x72, 114,r
0x0A,0x19,0x15,0x13,0x8A,     //0x73, 115,s
0x08,0x7E,0x09,0x02,0x80,     //0x74, 116,t
0x1E,0x01,0x01,0x02,0x9F,     //0x75, 117,u
0x18,0x06,0x01,0x06,0x98,     //0x76, 118,v
0x1E,0x01,0x02,0x01,0x9E,     //0x77, 119,w
0x11,0x0A,0x04,0x0A,0x91,     //0x78, 120,x
0x00,0x72,0x09,0x09,0xFE,     //0x79, 121,y
0x00,0x11,0x13,0x15,0x99,     //0x7A, 122,z
0x08,0x2A,0x55,0x41,0x80,     //0x7B, 123,{
0x00,0x00,0x7F,0x00,0x80,     //0x7C, 124,|
0x00,0x41,0x5D,0x2A,0x88,     //0x7D, 125,}
0x08,0x10,0x08,0x10,0x80,     //0x7E, 126,~







};

#endif /*FONT_H_*/
14  Using Arduino / Programming Questions / Scrolling Led Matrix Serial Help !! on: February 03, 2012, 08:53:10 pm
i am having trouble with a serial input for my code i want to display a serial input on my matrices you input the char string in the line of coding that says, char message_00[] PROGMEM = "" ; , in between the "quotes"  and i tried setting the serial input to a char value called incomingByte and the replacing the code above with , char message_00[] PROGMEM = incomingByte ;, but that just give me an error so if anyone can give me input or idea it would be much appreciated below is my code thank you for your help.


Code:
//We always have to include the library
#include "LedControl.h"
#include "font.h"
#include <avr/pgmspace.h>

/*
 Now we need a LedControl to work with.
 ***** These pin numbers will probably not work with your hardware *****
 pin 12 is connected to the DataIn
 pin 11 is connected to the CLK
 pin 10 is connected to LOAD
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(12,11,10,2);
char incomingByte;
void setup() {
  //we have already set the number of devices when we created the LedControl
  int devices=lc.getDeviceCount();
  //we have to init all devices in a loop
  for(int address=0;address<devices;address++) {
    /*The MAX72XX is in power-saving mode on startup*/
    lc.shutdown(address,false);
    /* Set the brightness to a medium values */
    lc.setIntensity(address,8);
    /* and clear the display */
    lc.clearDisplay(address);
  }
  Serial.begin(9600);
  
}

// Change these values to adjust scroll speeds and animation iterations

#define TEXT_SCROLL_SPEED 20      // how fast to scrill the text (wait)

#define REPEAT_TEXT 1              // how often to repeat the text if in cycling mode

// How to add a new message:
// * add the new message (only upper case, see font.h)
// * adjust MAX_MESSAGES
// * add the new message to messages
// NOTE: messages may not be longer than 255 chars.
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193587488
// Since 0012, PGM_P is broken. Fortunately there's a workaround

char message_00[] PROGMEM = "" ;
char message_01[] PROGMEM  = "" ;
char message_02[] PROGMEM = "";

#define MAX_MESSAGES 3
//PGM_P PROGMEM messages[] = {
PROGMEM const char *messages[] = {  
    message_00
   ,message_01
 ,message_02
};

uint8_t screen_mem[16];                  // screen memory
uint8_t active_row=1;                  // active row
uint8_t message_ptr = 0;                 // points to the active char in the message
uint8_t message_displayed = 0;           // how often has the message been displayed?
uint8_t active_char = 0;                 // stores the active char
uint8_t message_length = 0;              // stores the length of the active message
uint8_t char_ptr = 0;                    // points to the active col in the char
uint8_t char_length = 0;                 // stores the length of the active char
/*
 * copy screen_mem[] to LED Matrix 8x8
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */
  int i;
  for (i=0; i<8; i++){
      lc.setColumn(1,i,screen_mem[i+8]);
                lc.setColumn(0,i,screen_mem[i]) ;
}
}
/*
 * show_char
 * Displays the actual message.
 * Scrolls the screen to the left and draws new pixels on the right.
 * char stop bit is bit.7
 */
void show_char(const prog_uint8_t string[]) {
  uint8_t i;
  uint8_t b;

  // shift the screen to the left
  for (i = 0; i < 15; i++) {
    screen_mem[i] = screen_mem[i+1];
  }
  // advance a char if needed
  if (char_length == 0x80) {

    char_length =0;      //reset stop bit

    //read next char from progmem
    memcpy_P(&active_char,&string[message_ptr],1);
    //this is an alternativ PROGMEM access:
    //active_char =  pgm_read_byte_near(string + message_ptr);
    message_ptr++;

    //string stop byte 0x00
    if (active_char == 0) {
      message_ptr = 0;
      message_displayed++;
      char_length =0x80; // immediately read next char
    }

    active_char -= CHAR_OFFSET;
    char_ptr = 0;

    // this makes the space between two chars
    screen_mem[15]=0;
    return;
  }

  // read pixels for current column of char
  b = pgm_read_byte(&font[active_char * 5 + char_ptr]);
  char_ptr++;
  //char_length= (b & 0x01);
  //b = (b >> 1);
  char_length= (b & 0x80);
  b = (b & 0x7F);
  // write pixels into screen memory
  screen_mem[15] =b;
  Serial.print((uint16_t)active_char); Serial.print(" / "); Serial.println(char_ptr, HEX);
}


/*
 * copy_to_buffer
 * Copies the given sprite from PROGMEM to 8x8 LED RAM.
 */
void copy_to_buffer(const prog_uint8_t sprite[8]) {
  memcpy_P(screen_mem, sprite, 8);
}




void loop() {
  
     if (Serial.available() > 0)
  {
    
// read the incoming byte:
incomingByte = Serial.read();
Serial.print("I received: ");
Serial.print(incomingByte);
                
  }
  
  int devices=lc.getDeviceCount();
  int8_t i,j,k;

  while (1) {
  
  
  
      writeArduinoOnMatrix();
      delay(TEXT_SCROLL_SPEED);
    

    

    //6
    for (i = 0; i < MAX_MESSAGES; i++) {
      message_displayed = 0;
      while (message_displayed < REPEAT_TEXT) {
        show_char((uint8_t*)pgm_read_word(&(messages)));  //show_char((prog_uint8_t*)pgm_read_word(&(messages[i])));
        writeArduinoOnMatrix();
        delay(TEXT_SCROLL_SPEED);
      }
    }



  }

}
Pages: [1]