I am working on a project where I use an ESP32 to connect to the CAN Bus of a vehicle. I want to create small desktop App to read the data from the ESP32 with a USB Cable and display the data in a table. I have used Arduino IDE to develop a sketch for the EPS32 and that works well. I can see all the data in SavvyCAN. I now want to make my own tool to reverse engineer the CAN Data. the Idea was to use B4J but this will be my first B4J project. I have done many VB projects before. The issue I am facing is to get the Serial communication going. I have used ChatGPT but we are only going in circles.
This is my (ChatGPT) code:
This is my (ChatGPT) code:
B4X:
#Region Project Attributes
#MainFormWidth: 900
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Serial1 As Serial
Private AStream As AsyncStreams
Private btnConnect As Button
Private cmbPorts As ComboBox
Private txtLog As TextArea
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Main")
Serial1.Initialize("Serial1")
Dim Ports As List = Serial1.ListPorts
For Each p As String In Ports
cmbPorts.Items.Add(p)
Next
If cmbPorts.Items.Size > 0 Then
cmbPorts.SelectedIndex = 0
End If
Last edited: