The Night Rider is my first result with the netduino
I use two I2C PCF8574 portexpanders to 16 LEDs can be controlled.
On the clip you can see that the "pattern"on both portexpanders offered. The version of the firmware I used netduino: 4.1.0.5.
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace NightRider { public class Program { public static void Main() { new Thread( () => flashOnboardLed (200)).Start(); I2CDevice MyI2CBus = new I2CDevice(null); I2CDevice.Configuration pcf8574_0 = new I2CDevice.Configuration(0x20, 400); I2CDevice.Configuration pcf8574_1 = new I2CDevice.Configuration(0x21, 400); I2CDevice.I2CTransaction[] xActions = new I2CDevice.I2CTransaction[1]; int val = 0x0007; bool dir = false; byte[] cmd = new byte[1]; while (true) { MyI2CBus.Config = pcf8574_0; cmd[0] = (byte)(val ^ 0xFF) ; xActions[0] = I2CDevice.CreateWriteTransaction(cmd); MyI2CBus.Execute(xActions, 1000); MyI2CBus.Config = pcf8574_1; cmd[0] = (byte)((val >> 8) ^ 0xFF); xActions[0] = I2CDevice.CreateWriteTransaction(cmd); MyI2CBus.Execute(xActions, 1000); if ((val & 0x8000) > 0) dir = true; if ((val & 0x0001) > 0) dir = false; if (!dir) val = val << 1; else val = val >> 1; Thread.Sleep(60); } } public static void flashOnboardLed(object flashTime) { OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); while (true) { led.Write(!led.Read()); Thread.Sleep((int)flashTime); } } } }Hinnie.