public static void Main() { // write your code here InterruptPort button = new InterruptPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); button.OnInterrupt += new NativeEventHandler(button_OnInterrupt); PulseLed(); // Create a new I2C bus instance at startup. I2CBus i2cBus = I2CBus.GetInstance(); _BlinkM = new BlinkM(0x09); _ds1621 = new DS1621(0x48); // write something to a register. //_exampleSensor.WriteSomethingToSpecificRegister(); ShiftRegister _74HC595 = new ShiftRegister(Pins.GPIO_PIN_D2, Pins.GPIO_PIN_D0, Pins.GPIO_PIN_D1); //_74HC595.WriteMap(1, 255); _74HC595.WriteByte(0); _74HC595.WriteByte(0); _74HC595.ClockStorage(); _74HC595.WriteByte(255); _74HC595.WriteByte(1); _74HC595.ClockStorage(); while (true) { for (int j = 1; j <= 128; j = j * 2) { for (int i = 1; i <= 128; i = i * 2) { //Debug.Print("i[" + i + "] j[" + j); _74HC595.WriteByte(0,false); _74HC595.WriteByte(0,true); _74HC595.WriteByte(i, false); _74HC595.WriteByte(j, true); _74HC595.ClockStorage(); Thread.Sleep(100); } } /* for (int j = 1; j <= 128; j = j * 2) { for (int i = 1; i <= 128; i = i * 2) { Debug.Print("i[" + i + "] j[" + j); _74HC595.WriteByte(i); _74HC595.WriteByte(j); _74HC595.ClockStorage(); Thread.Sleep(200); } } * */ } //Bresenhams.Algorithms.Line(0,0,4,7,SetPixel); //Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].EnableStaticIP("10.0.0.222", "255.255.255.0", "10.0.0.4"); //Debug.Print("IP=" + Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0].IPAddress); Thread.Sleep(Timeout.Infinite); }
public MatrixDriver(ShiftRegister reg, MatrixDimension mat, int segments) { Register = reg; MatrixDim = mat; MatrixLength = segments*8; switch(MatrixDim){ case MatrixDimension.MatrixRow: map = new int[8 * (MatrixLength)]; // 4 segments in a row break; case MatrixDimension.MatrixBlock: map = new int[MatrixLength * MatrixLength]; break; } }