Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumWiring HardwareTangible computing › Basic arduino/wiring tutorials..?

Page Index Toggle Pages: 1
Basic arduino/wiring tutorials..? (Read 12485 times)
03/12/09 at 13:54:01

jj   Offline
YaBB Newbies

Posts: 4
*
 
Hello World!
     I'm a newbie, working my way through the advice and tutorials
on the arduino/wiring sites. Using Arduino 12 on a Mac, a Duemilanove,
and an 8x8 LED matrix with a Maxim 7219 chip...
In ' Wiring - Reference - Libraries - LED matrix - write ' I found a sketch
which creates a sprite called 'wave' and animates it across the matrix.
This looked good, worked well, and I could change the delay value to slow it
down... However, when I try to change the sprite in any way (shape, size,etc.)
I get an error message
...error: 'b00100100' was not declared in this scope In function 'void loop()':

I have not found an explanation for this. Am I not looking in the right places?
My questions are; - What has happened here?
                      - Where are the best simple tutorials?

Any advice would be welcomed. Thanks!
Im wondering if I should be on the arduino forum?
jj
 
IP Logged
 
Reply #1 - 03/13/09 at 02:18:03

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
Please post some code to look at it.

 
IP Logged
 
Reply #2 - 03/13/09 at 09:28:34

jj   Offline
YaBB Newbies

Posts: 4
*
 
13 mar '09

How random! (as the young people say)
Fiddling with the sprite got more and more strange.
Sometimes I could make the sprite smaller, sometimes I did not seem to
be able to change it at all without getting the error message on compiling.
I never was able to make the sprite bigger (than the LED matrix), which
is what I really wanted to do...

here's an example...

/* create a new Matrix instance
   pin 2: data  (din)
   pin 4: load  (load)
   pin 3: clock (clk)
*/

#include <Matrix.h>
#include <Binary.h>
#include <Sprite.h>

Matrix myMatrix = Matrix(2, 3, 4);

/* create a new Sprite instance
   14 pixels wide, 4 pixels tall
*/
Sprite wave = Sprite(
  14, 4,
  B00000011000000,                   //this line highlighted in error message!
  B00001000010000,
  B00100000000100,
  B10000000000001
);

void setup()
{
}

int x = 0;

void loop()
{
  myMatrix.write(x, 2, wave);      // place sprite on screen
  myMatrix.write(x - 8, 2, wave); // place sprite again, elsewhere on screen
  delay(75);                               // wait a little bit
  myMatrix.clear();                     // clear the screen for next animation frame
  if(x == 8)                                // if reached end of animation sequence
  {
    x = 0;                                   // start from beginning
  }
  x++;                                       // advance x coordinate to the right
}

error: 'B00000011000000' was not declared in this scope


I wish to be able to scroll, in x and y axes, around a 'picture' which is a lot bigger (say 25 x 25?) than the 8x8 LED matrix. Making a large 'sprite' and moving it around seemed like an elegant way of achieving this. However if the sprite size is limited I'll need to think again.

Is there a maximum 'sprite' size?
Does a large 'sprite' need too much memory?
Thanks. (I love my arduino)

jj
 
IP Logged
 
Reply #3 - 03/13/09 at 15:06:09

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi, ok got it, the Sprite are 8 pixels width, you can create multiple sprites but this should be maximum width for it. What you can do is to have different frames for your animation, each frame of 8 bits (8 pixel width) and then add as many rows as you want.
The error you are getting is because the constants are defined only for bytes from 0 to 255 (B00000000 to B11111111)

If you are interested you can look at the definition file for these constants here: http://wiring.uniandes.edu.co/source/trunk/wiring/core/Binary.h?revision=449&view=markup
let me know.
 
IP Logged
 
Reply #4 - 03/14/09 at 10:16:36

jj   Offline
YaBB Newbies

Posts: 4
*
 
Thanks. I'll think about this..!
Kind of you to comment.
jj
 
IP Logged
 
Page Index Toggle Pages: 1