element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino beginner
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 5 replies
  • Subscribers 392 subscribers
  • Views 478 views
  • Users 0 members are here
Related

Arduino beginner

Former Member
Former Member over 10 years ago

I'm fairly new to using an arduino and i've been trying to get a project to display numbers to a 8x8 led matrix and i'm having trouble getting it to display. All i get is is just a flashing of random lights on the matrix or two columns just stay lit and no interaction between my arduino and the display seems to be happening. Any way someone could trouble shoot my code and see if its a code error?

 

Here is the code:

 

#include <LedControl.h>

#define Num0 {B00111100, B01111110, B01100110, B01100110, B01101100, B01101100, B01111110, B00111100}

#define Num1 {B00011000, B00111000, B00111000, B00011000, B00011000, B00011000, B01111110, B01111110}

#define Num2 {B01111100, B01111110, B00000110, B00111110, B01111100, B01100000, B01111110, B00111110}

#define Num3 {B01111100, B01111110, B00000110, B00011110, B00011110, B00000110, B01111110, B01111100}

#define Num4 {B01100110, B01100110, B01100110, B01111110, B01111110, B00000110, B00000110, B00000110}

#define Num5 {B00111110, B01111110, B01100000, B01111100, B00111110, B00000110, B01111110, B01111100}

#define Num6 {B01111110, B01111110, B01100000, B01111110, B01100010, B01100010, B01100010, B01111110}

#define Num7 {B01111110, B01111110, B00000110, B00000110, B00000110, B00000110, B00000110, B00000110}

#define Num8 {B00111100, B01100110, B01100110, B01111110, B01111110, B01100110, B01100110, B00111100}

#define Num9 {B00111100, B01111110, B01100110, B01111110, B00111110, B00000110, B00000110, B00000110}

LedControl lc=LedControl(12,11,10,1);

unsigned long delayTime=1000;

byte number1[] = Num1;

byte number2[] = Num2;

byte number3[] = Num3;

byte number4[] = Num4;

byte number5[] = Num5;

byte number6[] = Num6;

byte number7[] = Num7;

byte number8[] = Num8;

byte number9[] = Num9;

byte number0[] = Num0;

 

 

void setup()

  // put your setup code here, to run once:

{

  lc.shutdown(0,false);  // Wake up displays

  lc.shutdown(1,false);

  lc.setIntensity(0,5);  // Set intensity levels

  lc.setIntensity(1,5);

  lc.clearDisplay(0);  // Clear Displays

  lc.clearDisplay(1);

}

void snumber0()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number1[i]);

  }

}

 

 

  void snumber1()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number1[i]);

  }

}

 

 

  void snumber2()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number2[i]);

  }

}

  void snumber3()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number3[i]);

  }

}

  void snumber4()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number4[i]);

  }

}

  void snumber5()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number5[i]);

  }

}

  void snumber6()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number6[i]);

  }

}

  void snumber7()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number7[i]);

  }

}

  void snumber8()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number8[i]);

  }

}

  void snumber9()

{

  for (int i = 0; i< 8; i++)

  {

    lc . setRow(0,i,number9[i]);

  }

}

 

 

void loop() {

    snumber0();

    delay(delayTime);

    snumber1();

    delay(delayTime);

    snumber2();

    delay(delayTime);

    snumber3();

    delay(delayTime);

    snumber4();

    delay(delayTime);

    snumber5();

    delay(delayTime);

    snumber6();

    delay(delayTime);

    snumber7();

    delay(delayTime);

    snumber8();

    delay(delayTime);

    snumber9();

    delay(delayTime);

   

 

 

}

  • Sign in to reply
  • Cancel
Parents
  • clem57
    clem57 over 10 years ago

    void snumber0()

    {

      for (int i = 0; i< 8; i++)

      {

        lc . setRow(0,i,number1[i]);

      }

    }

    Why snumber0 with number1?

    No spaces between lc and setRow allowed.

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • clem57
    clem57 over 10 years ago

    void snumber0()

    {

      for (int i = 0; i< 8; i++)

      {

        lc . setRow(0,i,number1[i]);

      }

    }

    Why snumber0 with number1?

    No spaces between lc and setRow allowed.

    C

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube