Hi, so I have changed a couple of things and it is still not working.
The program compiles, uploads but no code comes on.
@AWOL I tried having byte arrays, but the same thing happens.
@GoForSmoke I currently have it in progmem, but still nothing is happening.
Binary sketch size: 10,190 bytes (of a 32,256 byte maximum)
Any ideas on how to fix this?
here is all of my code:
orangeLOL:
/*
Orange section of planetarium, twinkle the stars then show constellations. not working as of 6pm 18/8
*/
#include "Charliplexing.h" //initializes the LoL Sheild library
#include "planet.h"
#include <avr/pgmspace.h>
//#define colour "orange"
#define cons 23// how many constellations there are
//orange = 23
//pink = 20
int GLOBALDELAY = 100;
int scrollSpeed = 50; //delay between frames
int xPosition = 0; //x position 0-13
int yPosition = 0; //y position 0-8
int frameCounter = 0; //used to find when the frame has filled up (126 leds)
int greyscale = 1; //greyscale color 0-7
bool set = true;
stargroup con[23];
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
Serial.print(" start set up ");
LedSign::Init(GRAYSCALE); //initializes a grayscale frame buffer
// if (colour == "orange")
// {
//declaring the constella
prog_int16_t xL[] = {2, 2 ,3, 3, 3, 3};
prog_int16_t yL[] = {1, 0, 8, 7, 6, 5};
stargroup L(6, xL, yL);
con[0] = L; //Set(L);
prog_int16_t xM[] = {3,3,3,3};
prog_int16_t yM[] = {4,3,2,1};
stargroup M(4, xM, yM);
con[1] = M; //Set(M);
prog_int16_t xN[] = {4,4,4,4};
prog_int16_t yN[] = {8,7,6,5};
stargroup N(4, xN, yN);
con[2] = N;
prog_int16_t xO[] = {4,4,4,4};
prog_int16_t yO[] = {4,3,2,1};
stargroup O(4, xO, yO);
con[3] = O;
prog_int16_t xq[] = {5,5,5,5,5};
prog_int16_t yq[] = {7,6,5,4,3};
stargroup q(5, xq, yq);
con[4] = q; //Set(M);
prog_int16_t xe[] = {13, 13};
prog_int16_t ye[] = {8,7};
stargroup e(2, xe, ye);
con[5] = e; //Set(M);
prog_int16_t xf[] = {0,0,0,0,0}; //06 05 04 03 02
prog_int16_t yf[] = {6,5,4,3,2};
stargroup f(5, xf, yf);
con[6] = f; //Set(M);
prog_int16_t xg[] = {0,0,1,1}; //01 00 18 17
prog_int16_t yg[] = {1,0,8,7};
stargroup g(4, xg, yg);
con[7] = g; //Set(M);
prog_int16_t xh[] = {1,1,1,1,1};
prog_int16_t yh[] = {6,5,4,3,2};
stargroup h(5, xh, yh);
con[8] = h; //Set(M);
prog_int16_t xi[] = {1,4}; //10 48
prog_int16_t yi[] = {0,8};
stargroup i(2, xi, yi);
con[9] = i; //Set(M);
prog_int16_t xj[] = {2,2}; //27 26
prog_int16_t yj[] = {7,6};
stargroup j(2, xj, yj);
con[10] = j; //Set(M);
prog_int16_t xk[] = {2,2,2,2};
prog_int16_t yk[] = {5,4,3,2};
stargroup k(4, xk, yk);
con[11] = k; //Set(M);
prog_int16_t xa[] = {5,5,5,6,6,6}; //52 51 50 68 67 66
prog_int16_t ya[] = {2,1,0,8,7,6};
stargroup a(6, xa, ya);
con[12] = a; //Set(M);
prog_int16_t xb[] = {6,6,6,6};
prog_int16_t yb[] = {5,4,3,2};
stargroup b(4, xb, yb);
con[13] = b; //Set(M);
prog_int16_t xc[] = {6,6,7,7,7,7,7,7,7,7}; //61 60 78 77 76 75 74 73 72 71
prog_int16_t yc[] = {1,0,8,7,6,5,4,3,2,1};
stargroup c(10, xc, yc);
con[14] = c; //Set(M);
prog_int16_t xd[] = {7,8,8,8,8,8}; //06 05 04 03 02
prog_int16_t yd[] = {0,8,7,6,5,4};
stargroup d(6, xd, yd);
con[15] = d; //Set(M);
prog_int16_t xs[] = {8,8};
prog_int16_t ys[] = {3,2};
stargroup s(2, xs, ys);
con[16] = s; //Set(M);
prog_int16_t xt[] = {8,8,9,9};
prog_int16_t yt[] = {1,0,8,7};
stargroup t(4, xt, yt);
con[17] = t; //Set(M);
prog_int16_t xv[] = {9,9,9,9};
prog_int16_t yv[] = {6,5,4,3};
stargroup v(4, xv, yv);
con[18] = v; //Set(M);
prog_int16_t xw[] = {9,9,9,10,10,10};
prog_int16_t yw[] = {2,1,0,8,7,6};
stargroup w(6, xw, yw);
con[19] = w; //Set(M);
prog_int16_t xx[] = {10,10,10,10,10};
prog_int16_t yx[] = {5,4,3,2,1};
stargroup x(5, xx, yx);
con[20] = x; //Set(M);
prog_int16_t xy[] = {10, 11};
prog_int16_t yy[] = {0,8};
stargroup y(2, xy, yy);
con[21] = y; //Set(M);
prog_int16_t xz[] = {11,11,11};
prog_int16_t yz[] = {7,6,5};
stargroup z(3, xz, yz);
con[22] = z; //Set(M);
prog_int16_t xzz[] = {11,11};
prog_int16_t yzz[] = {4,3};
stargroup zz(2, xzz, yzz);
con[23] = zz;
}
void loop() // run over and over again
{
Serial.print(" we are here ");
// int count = 0; //used for timing
bool up = true; //up is used for twinkle direction.
int lightup = 0; //used for which constellation is to be chosen.
for (int k = 0; k < 10000; k++)
{
//If the frame counter is full, then it delays for scrollSpeed.
if(frameCounter == 126)
{
delay(scrollSpeed);
frameCounter=0;
// LedSign::Set(random(13), random(8), random(7));
// count++;
}
//at the end of the row, it advances Y to the next one
if(xPosition == 13)yPosition++;
//at the end of the row, it starts from the first LED in the next one
if(xPosition > 13)xPosition=0;
//at the end of the frame, it starts from the begining again
if(yPosition > 8)yPosition=0;
//twinkle the lights between 2 and 6 so they dont turn off completly
if(greyscale > 6) up = false;
if(greyscale < 2) up = true;
if (up) greyscale++;
if (!up) greyscale--;
// here are some variations for twinkles, but they are commented out
// greyscale = random(7); //random (comment out increment above)
// if(greyscale > 7)greyscale= 0; // original
// if(greyscale > 7)greyscale= 4; //light twinkle
//sends the current x, y, and color to the frame, one LED at a time
LedSign::Set(xPosition, yPosition, greyscale); //set normal light to twinkle
LedSign::Set(random(13), random(8), random(2,6)); //set random light to random value.
//the counters are at the end of the loop, which will advance everything
//for the next frame
xPosition++;
frameCounter++;
}
for (int i = 0; i < cons; i++)
{
con[i].fadeOffAll();
}
delay(1000);
for (int i = 0; i < 5; i++)
{
lightup = random(cons);
con[lightup].fadeOn();
delay(500);
con[lightup].fadeOff();
delay(500);
}
// count = 0;
}
/////////////////////////////////////////
planet.h
/*
// planet.h
//
This is the header file for the planatarium. This provides a class for each of the constelations. There is a global array set up in the main file that has as many constellations for that section. (EG oragne has 27)
Individual constellations are defined as x and y pos in the setup loop. The main loop then just uses the global array of objects to trigger the events.//
// Created by Rory McKay on 12/08/12.
// TODO: clean up privacy issues, take out any extra code.
*/
#ifndef _planet_h
#define _planet_h
#include "Charliplexing.h"
#include <avr/pgmspace.h>
class stargroup
{
public:
//constructors
stargroup();
stargroup(int, prog_int16_t[], prog_int16_t[]);
stargroup& operator= (const stargroup &source);
//patterns
void fadeOn();
void on();
void fadeOff();
void fadeOffAll();
void off();
//variables
prog_int16_t xPos[16];
prog_int16_t yPos[16];
int noOfStars;
};
void empty(int[], int[]);
#endif