×

SparkFun Electronics will be closed on November 26, 2020 and November 27, 2020 for the Thanksgiving holiday. We will begin normal operations at 9:00 AM Mountain Time on November 30, 2020.

×

Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.

Jim D

Member Since: October 9, 2009

Country: United States

  • Hi Mark, I only needed a big red/green LED, so I set all values to the same data. It should not be too hard to update the code for patterns instead. I also use only USB power. With an external supply it uses about 250mA. Your USB port needs to be able to supply at least that. Here is my trivial test code for a simple all LED color, red then green.

    #include spi.h  // this forum strips off the angle brackets
    
    // Connect to "Output SPI" JP4 on LED Matrix
    // DIO 10 = CSn  (JP4-3)
    // DIO 11 = MOSI (JP4-2)
    // DIO 13 = SCK  (JP4-4)
    //     5V = VCC  (JP4-5 or JP4-6)
    //    GND = GND  (JP4-1)
    
    const int CSn = 10;
    const int ColorRED = 2;
    const int ColorGREEN = 1;
    
    void setup()
    {
        pinMode (CSn, OUTPUT);
        SPI.begin();
        SPI.setClockDivider(SPI_CLOCK_DIV128);
        SPI.setDataMode(SPI_MODE0);
    }
    
    void loop()
    {
        SetLED(ColorRED);
        delay(1000);
        SetLED(ColorGREEN);
        delay(1000);
    }
    
    void SetLED(int color)
    {
        digitalWrite(CSn,LOW);
        delay(1);
        for (int bytenum = 0; bytenum < 64; bytenum++)
            SPI.transfer(color);
        delay(1);
        digitalWrite(CSn,HIGH);
    }
    
  • Hi Mark, Do you still need some example code?

    Also, as noted above by Skaros, this board has an error. Use the 'SPI Output' connector as the input and 'SPI Input' as the output and it works fine. They mixed up the MISO and MOSI signals.

    Jim

No public wish lists :(