コード例 #1
0
        public static void SSD1306Demo()
        {
            Console.WriteLine("Two Circle");
            //two circles
            oled.DrawCircle(31, 31, 30);
            oled.DrawFilledCircle(97, 31, 30);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("Archery Target");
            //archery target
            oled.DrawFilledCircle(63, 31, 30);
            oled.DrawCircle(63, 31, 25, false);
            oled.DrawCircle(63, 31, 20, false);
            oled.DrawCircle(63, 31, 15, false);
            oled.DrawCircle(63, 31, 10, false);
            oled.DrawCircle(63, 31, 5, false);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("Invert");
            oled.SetInverseDisplay(true);
            Thread.Sleep(3000);
            oled.SetInverseDisplay(false);

            Console.WriteLine("Rectangles");
            oled.DrawRectangle(5, 20, 40, 40);
            oled.DrawFilledRectangle(50, 20, 50, 40);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("Rounded Rect");
            oled.DrawRoundRect(5, 20, 40, 40, 10);
            oled.DrawRoundFilledRect(50, 20, 50, 40, 10);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("Scrolling");
            oled.StartScrollHorizontally(true, 0, 0xff);
            Thread.Sleep(3000);

            oled.StartScrollHorizontally(false, 0, 0xff);
            Thread.Sleep(3000);
            oled.StartScrollVerticallyHorizontally(true, 0, 0xff, 0x02);
            Thread.Sleep(3000);
            oled.StartScrollVerticallyHorizontally(true, 0, 0xff, 0x0A);
            Thread.Sleep(3000);
            oled.DeactivateScroll();

            oled.Clear();

            Console.WriteLine("Triangle and Line");
            oled.DrawLine(10, 10, oled.Width - 10, oled.Height - 10);
            oled.DrawTriangle(5, 20, 5, 60, 63, 60);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();


            Console.WriteLine("Text smaller");
            oled.DrawText(0, 0, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(), 1);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("Text bigger");
            oled.DrawText(0, 0, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(), 2);

            oled.Display();
            Thread.Sleep(3000);
            oled.Clear();

            Console.WriteLine("---------------------");
        }