Jim D

Member Since: October 9, 2009

Country: United States

  • Product COM-00759 | about 2 years ago

    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);
    }
    
  • Product COM-00759 | about 2 years ago

    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 :(