<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:'times new roman', 'new york', times, serif;font-size:12pt"><div>Hey all, so i am new to the whole cult thing and am needing some help with some code i am tryin to adapt from the arduino site to make this 5x5 matrix work directly off dork board problem is that there are errors and im not savvy enough with programming to work it out, more of a production kinda guy not so much a software kinda guy. anyway i digress and will thank you all in advance for any help you might be about to give me. </div><div><br></div><div>michael</div><div><br></div><div>here is code. also as a side not you can seei jusr shortened the defined space and changed row and column things to reflec the size of my matrix. there is a part in the code that speaks of pin 11 and i am not using it so maybe thats one problem but, the error messages have no mention of this, and i have
installed all libraries in the correct locations and everything. or anyone have some 5x5 code layin around? thanks again!</div><div><br></div><div><div>/*</div><div> * Show messages on an 5x5 led matrix,</div><div> * scrolling from right to left.</div><div> * </div><div> * Uses FrequencyTimer2 library to</div><div> * constantly run an interrupt routine</div><div> * at a specified frequency. This</div><div> * refreshes the display without the</div><div> * main loop having to do anything.</div><div> *</div><div> */</div><div><br></div><div>#include <FrequencyTimer2.h></div><div><br></div><div>#define SPACE { \</div><div> {0, 0, 0, 0, 0}, \</div><div> {0, 0, 0, 0, 0}, \</div><div> {0, 0, 0, 0, 0}, \</div><div> {0, 0, 0, 0, 0}, \</div><div> {0, 0, 0, 0, 0}, \</div><div> </div><div>}</div><div><br></div><div>#define H { \</div><div> {1, 0, 0, 0, 1}, \</div><div> {1, 0, 0, 0, 1}, \</div><div>
{1, 1, 1, 1, 1}, \</div><div> {1, 0, 0, 0, 1}, \</div><div> {1, 0, 0, 0, 1}, \</div><div> </div><div>}</div><div><br></div><div>#define E { \</div><div> {1, 1, 1, 1, 1}, \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 1, 1, 0, 0}, \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 1, 1, 1, 1}, \</div><div> </div><div>}</div><div><br></div><div>#define L { \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 0, 0, 0, 0}, \</div><div> {1, 1, 1, 1, 1}, \</div><div> </div><div>}</div><div><br></div><div>#define O { \</div><div> {0, 1, 1, 1, 0}, \</div><div> {1, 0, 0, 0, 1}, \</div><div> {1, 0, 0, 0, 1}, \</div><div> {1, 0, 0, 0, 1}, \</div><div> {0, 1, 1, 1, 0}, \</div><div> </div><div>}</div><div><br></div><div>byte col = 0;</div><div>byte leds[5][5];</div><div><br></div><div>//
pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)</div><div>int pins[11]= {-1, 4, 3, 14, 17, 13, 12, 10, 9, 8, 6};</div><div><br></div><div>// col[xx] of leds = pin yy on led matrix</div><div>int cols[5] = {pins[13], pins[3], pins[4], pins[10], pins[06]};</div><div><br></div><div>// row[xx] of leds = pin yy on led matrix</div><div>int rows[5] = {pins[9], pins[14], pins[8], pins[12], pins[1]};</div><div><br></div><div>const int numPatterns = 6;</div><div>byte patterns[numPatterns][5][5] = {</div><div> H,E,L,L,O,SPACE</div><div>};</div><div><br></div><div>int pattern = 0;</div><div><br></div><div>void setup() {</div><div> // sets the pins as output</div><div> for (int i = 1; i <= 10; i++) {</div><div> pinMode(pins[i], OUTPUT);</div><div> }</div><div><br></div><div> // set up cols and rows</div><div> for (int i = 1; i <= 5; i++) {</div><div> digitalWrite(cols[i - 1],
LOW);</div><div> }</div><div><br></div><div> for (int i = 1; i <= 5; i++) {</div><div> digitalWrite(rows[i - 1], LOW);</div><div> }</div><div><br></div><div> clearLeds();</div><div><br></div><div> // Turn off toggling of pin 11</div><div> FrequencyTimer2::disable();</div><div> // Set refresh rate (interrupt timeout period)</div><div> FrequencyTimer2::setPeriod(2000);</div><div> // Set interrupt routine to be called</div><div> FrequencyTimer2::setOnOverflow(display);</div><div><br></div><div> setPattern(pattern);</div><div>}</div><div><br></div><div>void loop() {</div><div> pattern = ++pattern % numPatterns;</div><div> slidePattern(pattern, 60);</div><div>}</div><div><br></div><div>void clearLeds() {</div><div> // Clear display array</div><div> for (int i = 0; i < 5; i++) {</div><div> for (int j = 0; j < 5; j++) {</div><div> leds[i][j] = 0;</div><div>
}</div><div> }</div><div>}</div><div><br></div><div>void setPattern(int pattern) {</div><div> for (int i = 0; i < 5; i++) {</div><div> for (int j = 0; j < 5; j++) {</div><div> leds[i][j] = patterns[pattern][i][j];</div><div> }</div><div> }</div><div>}</div><div><br></div><div>void slidePattern(int pattern, int del) {</div><div> for (int l = 0; l < 5; l++) {</div><div> for (int i = 0; i < 4; i++) {</div><div> for (int j = 0; j < 5; j++) {</div><div> leds[j][i] = leds[j][i+1];</div><div> }</div><div> }</div><div> for (int j = 0; j < 5; j++) {</div><div> leds[j][4] = patterns[pattern][j][0 + l];</div><div> }</div><div> delay(del);</div><div> }</div><div>}</div><div><br></div><div>// Interrupt routine</div><div>void display() {</div><div> digitalWrite(cols[col], LOW); // Turn whole previous column
off</div><div> col++;</div><div> if (col == 5) {</div><div> col = 0;</div><div> }</div><div> for (int row = 0; row < 5; row++) {</div><div> if (leds[col][4 - row] == 1) {</div><div> digitalWrite(rows[row], LOW); // Turn on this led</div><div> }</div><div> else {</div><div> digitalWrite(rows[row], HIGH); // Turn off this led</div><div> }</div><div> }</div><div> digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)</div><div> delayMicroseconds(900); // Delay so that on times are longer than off time = brighter leds</div><div>}</div></div><div style="position:fixed"></div></div><br>
</body></html>