static void Main(string[] args) { var ft232Device = FT232HDetector.Detect(); if (ft232Device.Ok) { System.Console.WriteLine(ft232Device.ToString()); } // MCP3088 and MAX7219 is limited to 10Mhz var clockSpeed = MpsseSpiConfig._30Mhz; // clockSpeed = MpsseSpiConfig._10Mhz; var ft232hGpioSpiDevice = new GpioSpiDevice(MpsseSpiConfig.Make(clockSpeed)); var spi = ft232hGpioSpiDevice.SPI; var gpios = ft232hGpioSpiDevice.GPIO; GpioSample(gpios, true); CypressFlashMemorySample(spi); //Api102RgbLedSample(spi); // ADC_MCP3008Demo(spi); GpioSample(gpios, true); }
static void Main(string[] args) { var ft232Device = FT232HDetector.Detect(); if (ft232Device.Ok) { System.Console.WriteLine(ft232Device.ToString()); } else { Environment.Exit(1); } // MCP3088 and MAX7219 is limited to 10Mhz var clockSpeed = MpsseSpiConfig._30Mhz; // clockSpeed = MpsseSpiConfig._10Mhz; var ft232hGpioSpiDevice = new GpioSpiDevice(MpsseSpiConfig.Make(clockSpeed)); var spi = ft232hGpioSpiDevice.SPI; var gpios = ft232hGpioSpiDevice.GPIO; var max = gpios.MaxGpio; var pin = 3; gpios.SetPinMode(pin, PinMode.Output); for (var iI = 0; iI < 10; ++iI) { //for (var pin = 0; pin < gpios.MaxGpio; ++pin) { gpios.DigitalWrite(pin, PinState.High); Thread.Sleep(500); gpios.DigitalWrite(pin, PinState.Low); Thread.Sleep(500); } } Thread.Sleep(100); //GpioSample(gpios, true); }
static void Main(string[] args) { var ft232Device = FT232HDetector.Detect(); if (ft232Device.Ok) { System.Console.WriteLine(ft232Device.ToString()); } else { Environment.Exit(1); } Cls(ft232Device.ToString()); // MAX7219 is limited to 10Mhz var ft232hGpioSpiDevice = new GpioSpiDevice(MpsseSpiConfig.Make(MpsseSpiConfig._10Mhz)); var spi = ft232hGpioSpiDevice.SPI; #if DEMO_WITH_4_8x8_LED_MATRIX_CHAINED var matrixChainedCount = 8; var origin = NusbioMatrix.MAX7219_WIRING_TO_8x8_LED_MATRIX.OriginUpperLeftCorner; // Different Wiring for 4 8x8 LED Matrix sold by MadeInTheUSB #else var matrixChainedCount = 1; var origin = NusbioMatrix.MAX7219_WIRING_TO_8x8_LED_MATRIX.OriginBottomRightCorner; #endif var matrix = NusbioMatrix.Initialize(spi, origin, matrixChainedCount); matrix.DrawRect(1, 1, 4, 4, true); matrix.WriteDisplay(0); while (true) { if (Console.KeyAvailable) { var k = Console.ReadKey(true).Key; if (k == ConsoleKey.D0) { Animate(matrix, 0); } if (k == ConsoleKey.D1) { DisplaySquareImage1(matrix, 0); } if (k == ConsoleKey.D2) { DisplaySquareImage2(matrix, 0); } if (k == ConsoleKey.Q) { break; } if (k == ConsoleKey.A) { DrawAxis(matrix, 0); } if (k == ConsoleKey.R) { RotateMatrix(matrix, 0); } if (k == ConsoleKey.S) { ScrollDemo(matrix, 0); } if (k == ConsoleKey.P) { PerformanceTest(matrix, 0); // Speed test } if (k == ConsoleKey.C) { matrix.Clear(all: true, refresh: true); } if (k == ConsoleKey.T) { ScrollText(matrix); } if (k == ConsoleKey.L) { LandscapeDemo(matrix); } Cls(ft232Device.ToString()); matrix.Clear(all: true, refresh: true); } } }