Can someone tell me why this does not work?
The first time through the while(true), all the lights on the 74HC595 light up.
But not the second time through.
//References
//FEZPanda_GHIElectronics.NETMF.FEZ
//Microsoft.SPOT.Hardware
//Microsoft.SPOT.Native
//mscorlib
//System
using System;
using Microsoft.SPOT;
using System.Threading;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.FEZ;
////SPI1 SCK (Clock) Di13
////SPI1 MISO (Input) Di12
////SPI1 MOSI (Output) Di11
namespace LED_Shifter
{
public class Program
{
public static void Main()
{
SPI spi;
SPI.Configuration config;
config = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di10, false, 0, 0, true, true, 250, SPI.SPI_module.SPI1);
spi = new SPI(config);
byte[] data = new byte[1];
while (true)
{
data[0] = (byte)255;
spi.WriteRead(data, data);
Thread.Sleep(1000);
Debug.Print("Start");
data[0] = (byte)0;
spi.WriteRead(data, data);
Thread.Sleep(1000);
Debug.Print("End");
}
}
}
}