Beispiel #1
0
        public static void DisplaySpaceInvaders()
        {
            var random           = new Random((int)DateTime.Now.Ticks);
            var cropCircles      = new ArrayList();
            var maxSpaceInvaders = 5;

            for (var count = 0; count < maxSpaceInvaders; count++)
            {
                cropCircles.Add(new CropCircleLocation(random, AdaFruitSSD1306.Width, AdaFruitSSD1306.Height));
            }

            while (true)
            {
                oled.ClearScreen();
                foreach (CropCircleLocation loc in cropCircles)
                {
                    loc.Move(AdaFruitSSD1306.Width, AdaFruitSSD1306.Height);
                    oled.DrawBitmap(loc.x, loc.y, ref spaceInvader, 16, 16, AdaFruitSSD1306.Color.White);
                }
                oled.Refresh();
            }
        }
Beispiel #2
0
        public static void Main()
        {
            var oled = new AdaFruitSSD1306(
                CHIPSELECT: Pins.GPIO_PIN_D10,
                RESET: Pins.GPIO_PIN_D9,
                DC: Pins.GPIO_PIN_D8,
                CLOCK: Pins.GPIO_PIN_D13,
                DATA: Pins.GPIO_PIN_D11);

            oled.Select(true);

            oled.Initialize();

            while (true)
            {
                oled.Clear();
                oled.DrawBitmap(0, 0, ref netduino, 128, 64, AdaFruitSSD1306.Color.WHITE);

                oled.Display();
                oled.Clear();

                int line = 1;

                oled.DrawString(0, line++, "######################");
                oled.DrawString(0, line++, "   Ada Fruit OLED");
                oled.DrawString(0, line++, "  SSD1306 Display");
                oled.DrawString(0, line++, " & netduino helpers");
                oled.DrawString(0, line++, "   by Fabien Royer");
                oled.DrawString(0, line++, " http://codeplex.com");
                oled.DrawString(0, line++, "######################");

                oled.Display();
            }

            //oled.Select(false);
        }