rausch88
Posts: 11
Joined: Fri May 01, 2015 3:19 pm

IOT with VB

Sat May 02, 2015 3:05 pm

Hy

Does somebody of you know if it is suitable to write for Windows IOT with Visual Basic?
In the examples I anytime only see C++ and C#.

Thanks for answers.

mfraiss
Posts: 3
Joined: Sat May 02, 2015 9:09 pm

Re: IOT with VB

Sat May 02, 2015 9:14 pm

As far as i know, there is nothing planned to support Visual Basic on the IoT plattform. Why do you need to write it in VB? :shock:

pwinwood
Posts: 76
Joined: Mon Jul 02, 2012 2:21 am
Location: Oxford, England

Re: IOT with VB

Sat May 02, 2015 9:32 pm

You can certainly create a Windows Universal project with VB.Net
I have tried deploying it to the Pi yet.

tohipfortheroom
Posts: 65
Joined: Mon Apr 27, 2015 11:05 pm

Re: IOT with VB

Sat May 02, 2015 9:38 pm

VB apps work on the pi I deployed one yesterday

rausch88
Posts: 11
Joined: Fri May 01, 2015 3:19 pm

Re: IOT with VB

Sat May 02, 2015 9:57 pm

Ok
I think ist the better language.
Did you tried to comunicate with the GPIO Pins?

User avatar
AES256
Posts: 6
Joined: Sun May 03, 2015 10:37 am

Re: IOT with VB

Sun May 03, 2015 11:50 am

rausch88 wrote:Ok
I think ist the better language.
Did you tried to comunicate with the GPIO Pins?
Hi,
The good news is that its possible to write apps for IoT in VB.NET (why wouldn't it be???). You can even access the GPIO pins.
Here's a short example to swith on/off a LED connected RPi2 GPIO pins. Do the followings:
1. Create a new Windows Universal Blank App project in Visual Studio 2015 RC
2. Add reference: "Windows IoT Extension SDK". (Project -> Add Reference -> Windows Universal -> Extensions: "Windows IoT Extension SDK")
3. Add a button to the MainPage.

Code: Select all

Imports Windows.Devices.Gpio
Public NotInheritable Class MainPage
    Inherits Page
    Private gpio
    Private pin As GpioPin
    Private Const LED_PIN = 18

    Private Sub button_Click(sender As Object, e As RoutedEventArgs) Handles button.Click
        Call TurnLedOnOff()
    End Sub

    Private Sub TurnLedOnOff()

        'Check if gpio was already initialied
        If gpio Is Nothing Then
            gpio = GpioController.GetDefault
        End If

        'Check if LED's pin was already initialied
        If pin Is Nothing Then
            pin = gpio.OpenPin(LED_PIN)
            pin.Write(GpioPinValue.Low)
            pin.SetDriveMode(GpioPinDriveMode.Output)
        End If

        'Read pin status and invert state
        If pin.Read = GpioPinValue.High Then
            pin.Write(GpioPinValue.Low)
        Else
            pin.Write(GpioPinValue.High)
        End If
    End Sub
End Class
Last edited by AES256 on Thu May 14, 2015 6:43 pm, edited 1 time in total.
Peter

rausch88
Posts: 11
Joined: Fri May 01, 2015 3:19 pm

Re: IOT with VB

Sat May 09, 2015 12:52 pm

Hi

Do you know if there coming some examples for this?

User avatar
AES256
Posts: 6
Joined: Sun May 03, 2015 10:37 am

Re: IOT with VB

Sun May 10, 2015 2:22 pm

rausch88 wrote:Hi

Do you know if there coming some examples for this?
I guess C# will be (much) more popular in IoT apps development than VB.NET. I would suggest to learn the (very) basics of C# (it this is not the case) so you can understand and rewrite the posted codes in VB.NET.
Peter

GerritV
Posts: 91
Joined: Fri May 01, 2015 4:16 pm
Location: St Catharines, ON
Contact: Website

Re: IOT with VB

Sun May 10, 2015 4:43 pm

I used VB.Net for years, (long long ago started in assembler on a Univac II).

But I am thinking of moving to C#. The reality is that more and more examples are in C#, and converting them is at best a nuisance, at worst it eats into my retirement time.

I am using this to learn. http://blog.jerrynixon.com/2014/01/free ... s-and.html .
His site also covers XAML, which is used for GUI on the Universal Apps/WinIoT: http://blog.jerrynixon.com/p/learn.html

VS2015 Community Edition supports all 3 (C/C++, VB, C#) plus Java

Gerrit

rausch88
Posts: 11
Joined: Fri May 01, 2015 3:19 pm

Re: IOT with VB

Sun May 10, 2015 5:28 pm

I would be able to write it in C# but I dont like this language so I hope there will be more things with VB.

GerritV
Posts: 91
Joined: Fri May 01, 2015 4:16 pm
Location: St Catharines, ON
Contact: Website

Re: IOT with VB

Sun May 10, 2015 10:01 pm

I understand, I avoid java anything like the plague myself :-)

Try this, example is in VB. You will need to login to Live but that is the same user/pw as your Visual Studio 2015 RC so should be no problem.
http://blog.jerrynixon.com/2015/05/an-i ... ndows.html

Article itself (requires sign-in)
https://msdn.microsoft.com/en-us/magazine/dn973012.aspx

Gerrit

minmiroad
Posts: 1
Joined: Thu Aug 06, 2015 11:09 am

Re: IOT with VB

Thu Aug 06, 2015 11:15 am

Thanks AES256
I loaded up your sample program, followed your instructions. It worked.
:D

jboyer43
Posts: 10
Joined: Mon Jun 08, 2015 3:48 pm
Location: Canada

Re: IOT with VB

Wed Aug 12, 2015 9:40 pm

Vb 1 to 6... VB .Net 1 to 4.6. I understand the OP and being retired, my time is limited. But I hate ; and { I am using a converter and - so far - get what I want. My comfort zone in JavaScript or node.js or C# is too narrow to be useful. Maybe we need a forum for VB programming in IoT...Good coding.
Jerome

Smalldog
Posts: 3
Joined: Fri Jul 20, 2012 6:01 am

Re: IOT with VB

Thu Aug 13, 2015 6:45 am

I found it a little challenging to find any good solid examples on VB.NET code for Windows IoT, so I had to experiment for a bit until I found something that worked for me.

I started up VS2015, expanded Visual Basic -> Windows -> Universal, then selected "Blank App (Universal Windows)"
Enter the app name and location, click Ok.
Double click on the "MainPage.xaml" project item, it should open up.
Right click in the XAML code area, and select "View Code"
Add something like the following to get you started:

Code: Select all

Public Sub New()
    InitializeComponent()

    '  Add your own code after this point.

End Sub
I hope this helps someone get off the ground a little faster. I am surprised that the New() subroutine wasn't created automatically with the InitializeComponent() call.

If you are in fact developing for Raspberry Pi, be sure the set your platform at the top to ARM from x86.

Jeff

Return to “Windows 10 for IoT”