Third Preview of TinyCLR OS Core Features

@ John - You were spot on, there was one unnecessary entry in the source list.

Visual Basic too ?

Give us a example! Blink led in BASIC

@ scardinale - you can find a link on https://www.ghielectronics.com/docs/350/tinyclr-os at the bottom of the notes section for the 0.3.0 release that shows using a few of the new APIs in this release. Any display you could use in NETMF works here, just supply the correct configuration.

@ iamin - glad to hear you got it working

@ BASIC4EVER - see below:


Imports System.Threading
Imports GHIElectronics.TinyCLR.Devices.Gpio
Imports GHIElectronics.TinyCLR.Pins

Module Startup
    Sub Main()
        Dim controller = GpioController.GetDefault()
        Dim pin = controller.OpenPin(G30.GpioPin.PA0)

        pin.SetDriveMode(GpioPinDriveMode.Output)

        While True
            pin.Write(GpioPinValue.High)
            Thread.Sleep(100)
            pin.Write(GpioPinValue.Low)
            Thread.Sleep(100)
        End While
    End Sub
End Module

1 Like

Will TinyCLR OS in any way be compatible with the Azure IoT platform?? if not headed applications (which Windows 10 IoT Core is probably better because of UWP apps) i can see this very useful as headless (background) apps.

Generally Raspberry Pi 3 loaded with an UWP UI app is probably currently the cheapest option, but then for even smaller devices which don’t need UI, options are only Arduino, mbed, and maybe some others.

It would be great if you could create a version of G30 or G80 with a WIFI chip

something like Adafruit Feather [url]https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started[/url]
or Sparkfun Thing [url]https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-sparkfun-esp8266-thing-dev-get-started[/url]

maybe even SIM card, something like [url]https://hologram.io/dash/[/url]

and do some samples and documentation on how to bring this to the IoT bandwagon.

1 Like

@ Darko - Yes you can use TinyCLR with Azure. But please do not compare TinyCLR running on a tiny micro with Windows running on a full blown system. Each one has its own use. They complement each other, not replace one another.

1 Like

This is for TE35 we tested.

For different screen that supported by GHI, you can use their setting same as FEZ config shows.


static void TestLCD()
        {
            var displayController = DisplayController.GetDefault();

            displayController.ApplySettings(new LcdControllerSettings { Width = 320, Height = 240, HorizontalBackPorch = 27, HorizontalFrontPorch = 51, HorizontalSyncPolarity = false, HorizontalSyncPulseWidth = 41, OutputEnableIsFixed = true, OutputEnablePolarity = true, PixelClockRate = 15000000, PixelPolarity = true, VerticalBackPorch = 8, VerticalFrontPorch = 16, VerticalSyncPolarity = false, VerticalSyncPulseWidth = 10 });




            var background = Resources.GetBitmap(Resources.BitmapResources.Background);
            var font = Resources.GetFont(Resources.FontResources.small);
            var screen = Graphics.FromHdc(displayController.Hdc);

            screen.DrawLine(new Pen(Color.White, 2), 10, 10, 30, 10);
            screen.Flush();

            Thread.Sleep(1000);

            screen.Clear(Color.Black);
            screen.Flush();

            Thread.Sleep(1000);

            screen.DrawImage(background, 0, 40);
            screen.FillEllipse(new SolidBrush(Color.FromArgb(100, 0xFF, 0, 0)), 0, 0, 100, 100);
            screen.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0xFF)), 0, 100, 100, 100);
            screen.DrawEllipse(new Pen(Color.Blue), 100, 0, 100, 100);
            screen.DrawRectangle(new Pen(Color.Red), 100, 100, 100, 100);
            screen.DrawLine(new Pen(Color.Green, 5), 250, 0, 220, 240);
            screen.DrawString("Hello, world", font, new SolidBrush(Color.White), 10, 220);

            var i = 0;
            screen.DrawLine(new Pen(Color.Black, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.White, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Gray, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Red, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Green, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Blue, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Yellow, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Purple, 4), 260 + i, 10, 260 + i, 50); i += 4;
            screen.DrawLine(new Pen(Color.Teal, 4), 260 + i, 10, 260 + i, 50); i += 4;

            screen.Flush();

            using (var bmp = new Bitmap(2, 2))
            {
                var graphics = Graphics.FromImage(bmp);

                graphics.DrawLine(new Pen(Color.White, 1), 0, 0, 1, 0);

                using (var stream = new MemoryStream())
                {
                    bmp.Save(stream, ImageFormat.MemoryBmp);

                    var byteArray = stream.ToArray();
                }
            }

        }
2 Likes

@ DAT Why is there a difference in the LcdControllerSettings for PixelClockRate and HorizontalBackPorch for the G120/G120E and the G400?

@ Darko - What we really need is TinyCLR running on the Feather boards.

Code fixed. That was a copy/paste error from code used for testing. Yes they all should be the same.

1 Like

Hi.
Already TinyCLR0.3.0 and my Blink program still works. :smiley:

namespace TinyCLR_Blink
{
    public class Program
    {
        public static void Main()
        {
     	// Get the default GPIO controller on the system
            var gpio = GpioController.GetDefault(); // (1)

// Open GPIO Led1
            GpioPin led = gpio.OpenPin(FEZPandaIII.GpioPin.Led1); // (2)
// Set the IO direction as output
            led.SetDriveMode(GpioPinDriveMode.Output); // (3)

            while (true)
            {
                led.Write(GpioPinValue.High);
                Thread.Sleep(100);
                led.Write(GpioPinValue.Low);
                Thread.Sleep(300);
            }
        }
    }
}

It’s time to porting all my NetMF 4.3 libraries 8)

2 Likes

Is LCD Touch included in the things in [em]progress or under consideration[/em]. It is not included in the list.

For the capacitive touch LCD’s you can simply use the I2C driver that Skewworks created for the Newhaven displays. This will work with any FT5x based touch interface.

https://www.ghielectronics.com/community/codeshare/entry/1078

I have tried it and it does not work as expected. I have updated Skewworks source to use TinyCLR I2C and Gpio for the Interrupt Pin. I only get TouchDown and TouchMove events. No TouchUp events are generated.

Can you try it and see what results you get?

@ Gus - Great, so Microsoft.Azure.Devices.Client works with TinyCLR?

is there some documentation on how to flash the firmware on the G120 with TeraTerm?

At some point it should but now TinyCLR is an early preview, not even a beta yet. It is still missing a lot of features.

Do you have SoM module or on mainboard (and which model ?) ?

It can be useful : https://www.ghielectronics.com/community/forum/topic?id=24297&page=1#msg225257

@ scardinale - The list is not meant to be and is nowhere near exhaustive. Touch is something we will be investigating.

Is there some way we can vote on features to help certain things get bumped up the list. EG: For me, USB host is more important than other things.

I may have missed it but can the old Cerb family be updated to TinyCLR OS?

If the board doesn’t start with a “G” I wouldn’t expect any love going forward. Cerberus is still my favorite of all the GHI boards, though :cry: