Creanies home of my best hobby stuff. |
Home Pi B+ OS GAMBAS Trains Electronics Hardware Software Videos About |
GAMBAS Is a free development environment based on a Basic interpreter with object extensions, a bit like Visual Basic™ (but it is NOT a clone !). Read the introduction for more information. http://gambas.sourceforge.net/en/main.html CODE SAMPLE This is a simple communications program connected to a Modem, RFID reader or wireless modem using ttyUSB0. ![]() Above is the GUI layout for the app. ![]() Sample of the IDE code window. ' Gambas class file Private Sport As SerialPort Public Pp As Byte Public Po As Byte Public Rxs As String Public Sub Form_Open() Me.Load Me.Center End Public Sub Button2_Click() Sport = New SerialPort As "Sport" Po = 1 If TextBox3.Text = "N" Or TextBox3.Text = "n" Then pp = 0 End If With Sport .PortName = TextBox1.Text .Speed = TextBox2.Text .Parity = Pp .DataBits = TextBox4.Text .StopBits = TextBox5.Text .FlowControl = Val(TextBox6.text) Try .Open() Label9.Text = TextBox1.Text & ":" & TextBox2.Text & "," & TextBox3.Text & "," & TextBox4.Text & "," & TextBox5.Text & " OPEN" Label10.Background = &H00FF00& If Error Then Message(" Port " & TextBox1.Text & " not found -- TERMINATING PROGRAM") Quit Endif End With End Public Sub Sport_Read() Dim Rx As String Read #Sport, Rx, Lof(Sport) Rxs = Rxs & Rx If Rx = Chr$(13) Then TextArea1.Text = TextArea1.Text & Rxs Rxs = "" End If End Public Sub Button1_Click() If Po = 0 Then Message("Open the PORT") Else Print #Sport, Textbox7.Text; Chr$(13) End If End Public Sub Button3_Click() Sport.Close Label10.Background = &HFF0000& Label9.Text = "CLOSED" Po = 0 End Public Sub Button4_Click() TextArea1.Clear End Public Sub Button5_Click() EndIt() End Public Sub Form_Close() EndIt() End Public Sub EndIt() Try Sport.Close Quit If Error Then Quit Endif End Copyright (c) mgc Perth Western Australia 2015 and on |
LATEST NEWS I have Raspberry Pi B+ USB memory stick and SD card images available for download or I can supply the images mounted on 8 GB memory stick and a small SD card. |