NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » uint8_t array problems

July 19, 2011
by Tug
Tug's Avatar

Hey guys !

I have an issue in my code that I can't seem to solve on my own, I've been on it for a couple days.

Basically I have an array of integer from 0-24

uint8_t track1[] = {2,3,4,3,23,24,23,0}

That I am trying to display on the led array matrix 5x24 I have changed the testpattern part of the ledarray.c The first led that I am manually turning on works, but the other are a no go.

void ledarray_testpattern() {                                                //Bit I am trying to change
int i;

   for (i=0; i<52; i++) {





The thing is that I can't seem to see what is wrong with my code. I made sure I had the right class in the functions..Again, all the other code is the same as the ledarray.c provided by nerdkit.

Thanks for the help


July 19, 2011
by Tug
Tug's Avatar

disconnected the nerdkit and re-uploaded the code and it works :s

long live the joy of informatics!

July 20, 2011
by Tug
Tug's Avatar

Right, so the array stopped working...

My project is very similar to Nerdkit staffs' :

I noticed in their code they didn't use an array to have the tab of the song, they wrote down every note. Which I find tedious and not practical.

I can't seem to find a way to make it work. Which would help my project and their tutorial.


July 20, 2011
by Noter
Noter's Avatar

Are you writing the .data section to the hex file thus downloading it to the atmega? If not then your array does not initialize as you expect in ram. This is from my makefile, it's the "-j .data" that causes the data section to load.

avr-objcopy -j .text -j .data -O ihex $< $@
July 20, 2011
by Tug
Tug's Avatar

I do have that bit, found in thread 100.

I uploaded the original code, then my new one. It works now, I am not sure why it didn't before tho.

I'll keep you guys updated on my project ^^

Post a Reply

Please log in to post a reply.

Did you know that one NerdKits customer controlled a laser pointer with his computer using a microcontroller? Learn more...