This module can be interfaced to Netduino via SPI - just wire clock and data signals and send 16 bits with LED states. 3.3V should be enough for logic H, if the module is powered by 5V.
I can't find any source code / tutorial on this part. Could you show me how to do this please ?
According to this :
Here's how I do :
D0, D1 & D2 => data1, data2, data3
D5, D6 & D7 => clock1, clock2, clock3
Gnd & +5V
using System;
using System.Diagnostics;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
using SecretLabs.NETMF.Hardware.NetduinoPlus;
namespace NetduinoApplication1
{
public class Program
{
public static void Main()
{
var button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled);
// write your code here
OutputPort Data1 = new OutputPort(Cpu.Pin.GPIO_Pin0, false);
OutputPort Data2 = new OutputPort(Cpu.Pin.GPIO_Pin1, false);
OutputPort Data3 = new OutputPort(Cpu.Pin.GPIO_Pin2, false);
OutputPort Clock3 = new OutputPort(Cpu.Pin.GPIO_Pin5, false);
OutputPort Clock1 = new OutputPort(Cpu.Pin.GPIO_Pin6, false);
OutputPort Clock2 = new OutputPort(Cpu.Pin.GPIO_Pin7, false);
//SPI.Configuration conf = new SPI.Configuration(Cpu.Pin.GPIO_Pin8, false, 0, 0, true, false, 1000, SPI.SPI_module.SPI1);
//SPI spi = new SPI(conf);
byte i = 0;
while (true)
{
i++;
if (i >= byte.MaxValue)
i = 0;
//spi.Write(new byte[] { 0x21, 0xBF, 0x04, 0x14, 0x0C, 0x20, 0x0C });
shiftOut(Data1, Clock1, i);
shiftOut(Data2, Clock2, i);
shiftOut(Data3, Clock3, i);
Thread.Sleep(100);
//spi.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 });
shiftOut(Data1, Clock1, 0);
shiftOut(Data2, Clock2, 0);
shiftOut(Data3, Clock3, 0);
}
}
/// <summary>
/// Shift out override (Reverse clock HIGH/LOW)
/// </summary>
/// <param name="data"></param>
/// <param name="clock"></param>
/// <param name="val"></param>
static void shiftOut(OutputPort data, OutputPort clock, byte val)
{
for (int i = 0; i < 8; i++)
{
clock.Write(false);
data.Write(!((val & (1 << (7 - i))) == 1));
clock.Write(true);
}
}
}
}