Exemple #1
0
        public static void Main()
        {
            // turn off Ethernet in case of Netduino2Plus
            var ethernetPower = new OutputPort((Cpu.Pin) 47, false);

            ethernetPower.Write(false);

            AdafruitNeoPixel32x8 matrix = new AdafruitNeoPixel32x8();

            matrix.FontManager.SelectFont(Fonts.Farsi);

            matrix.Test0();

            //byte[] bytes = Properties.Resources.GetBytes(Properties.Resources.BinaryResources.TEST2);

            //matrix.PutBytes(0, 0, 32, 8, bytes, true);

            //using (Bitmap bmp = new Bitmap(bytes, Bitmap.BitmapImageType.Jpeg))
            //{
            //    matrix.PutBmp(0, 0, bmp, true);
            //}

            //Thread.Sleep(5000);

            //FarsiTranslator.Dump();

            while (true)
            {
#if false
                matrix.Clear(0x000010);
                matrix.FontManager.SelectFont(Fonts.Sinclair);
                matrix.WriteText(0, 0, "abcd", 0x1f0000, 0x000010, false);
                Thread.Sleep(5000);
                matrix.Clear(0x000010);
                matrix.FontManager.SelectFont(Fonts.Farsi);
                matrix.WriteTextR(0, 0, "!$ !$", 0x1f0000, 0x000010, false);
                Thread.Sleep(5000);
#endif
                //matrix.ScrollToRightText(1, 0, FarsiTranslator.Translate("آب باباپاتا"), 0x1f0000, 0x000010, 50);
                //matrix.ScrollToRightText(1, 0, "$!$!$!$!$", 0x1f0000, 0x000010, 50);
#if true
                matrix.FontManager.SelectFont(Fonts.Farsi);
                matrix.ScrollToRightText(0, 0, "!$!$ !$!$ !$!$ !$!$", 0x1f0000, 0x000010, 50);
                matrix.FontManager.SelectFont(Fonts.Sinclair);
                matrix.ScrollToRightText(0, 0, "abcd 0 efgh", 0x1f0000, 0x000010, 50);
#endif

#if true
                matrix.FontManager.SelectFont(Fonts.Sinclair);
                matrix.ScrollToLeftText(0, 0, "abcdefgh 0 lmn 23 qrt", 0x1f0000, 0x001000, 50);
                matrix.FontManager.SelectFont(Fonts.Farsi);
                matrix.ScrollToLeftText(0, 0, "!$!$ !$!$ !$!$ !$!$", 0x1f0000, 0x001000, 50);
#endif
            }
        }
Exemple #2
0
        public static void Main()
        {
            // There's a 8x8 matrix (64 LEDs) connected to the first SPI bus on the Netduino
            RgbMatrix matrix = new AdafruitNeoPixel32x8();

            matrix.Test0();

            NetworkInitializer.NetworkConnected += NetworkConnected;

            int delayCon = 0;

            IsConnecting = true;

            OutputPort led = new OutputPort(Pins.ONBOARD_LED, false);

            while (IsConnecting)
            {
                led.Write(false);  // turn on the LED
                Thread.Sleep(250); // sleep for 250ms
                led.Write(true);   // turn off the LED
                Thread.Sleep(250); // sleep for 250ms

                if (delayCon++ == 10)
                {
                    NetworkInitializer.InitializeNetwork();
                }
            }

            Debug.Print("Network connected!");

            // Creates a new web session
            HTTP_Client WebSession = new HTTP_Client(new IntegratedSocket("www.netmftoolbox.com", 80));

            // Requests the latest source
            HTTP_Client.HTTP_Response Response = WebSession.Get("/helloworld/");

            // Did we get the expected response? (a "200 OK")
            if (Response.ResponseCode != 200)
            {
                throw new ApplicationException("Unexpected HTTP response code: " + Response.ResponseCode.ToString());
            }

            var dateString = Response.ResponseHeader("date");

            //Pin1Irq = new IntegratedIRQ(Pins.GPIO_PIN_D1);
            //Pin1Irq.ID = "D1";
            //Pin1Irq.OnStateChange += OnStateChangeHandler;
            //Pin2Irq = new IntegratedIRQ(Pins.GPIO_PIN_D2);
            //Pin2Irq.ID = "D2";
            //Pin2Irq.OnStateChange += OnStateChangeHandler;

            var ethernetPower = new OutputPort((Cpu.Pin) 47, false);

            ethernetPower.Write(false);

            while (true)
            {
                matrix.ScrollToLeftText(1, 0, dateString, 0x130000, 100);
                Thread.Sleep(500);
            }
        }