3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Build a low cost, scrolling LED display for your Arduino microprocessor.

Step 6A test sketch

A test sketch
/* LMP Test
  • Copyright (c) 2009 qs@quantsuff.com
*
  • Scanning horizontal and vertical pixels
*
  • LED Matrix row:1-5; col:1-6
  • Map PORTB == D8:D12 pin[row+7] : +v
  • PORTD == D2:D7 pin[8-col] ; Gnd
  • Our output: col::D2:D7 -ve (LOW) while row::D8:D13 +ve
*/

int delayTime= 80; // 1mS increments before next LED
// change from 1-100 and see what happens
int delayStep;
int ledPin, col, row ;

void setup() // run once, when the sketch starts
{
for (ledPin=2; ledPin<=12; ledPin++) // Standard setup for LMP
{ pinMode(ledPin, OUTPUT); // sets the digital pin as output
digitalWrite(ledPin,(ledPin<=7)) ; // and sets all OFF
}
}

void loop() // run over and over again
/* Map PORTB == D8:D13
  • PORTD == D0:D7
  • Our output: col::D7:D2
  • (8-col) -ve (LOW)
  • while row::D8:D13 +ve
  • (row+7) +ve (HIGH)
*/
{
for (row=1; row<=5; row++) { // Vertical: left to right
digitalWrite(row+7,HIGH); // Enable entire ROW
for (col=1; col<=6; col++) { // then one pixel per col
digitalWrite(8-col,LOW); // gets turned on
delay(delayTime); // for a moment
digitalWrite(8-col,HIGH); // then OFF
} // before next one
digitalWrite(row+7, LOW); // We're done with this row
}

for (col=6; col>=1; col--) { // Going UP right to left
digitalWrite(8-col,LOW); // A shortcut: leave col enabled
for (row=5; row>=1; row--) {
digitalWrite(row+7,HIGH); // Turn 1 pixel on
delay(delayTime); // Wait a moment
digitalWrite(row+7,LOW); // then off...
}
digitalWrite(8-col,HIGH); // finished with this column
}
}
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
177
Followers
22
Author:qs