B4R Question Keyboard / Serial output

h725

Active Member
Licensed User
Longtime User
Hello community,

am working with an arduino nano and the onewire library:
https://www.b4x.com/android/forum/threads/onewire-dallas-1-wire-protocol.66672/#content
I get the ID from the device and it is written in the log-file.(At the moment it is reverse, but this
is another task.)

I would like to realize 2 things:
1.Keyboard output (still searching a solution)
2.Serial output - (SOLVED!)

1.Is it possible to get the ID as a normal keyboard-output?

2. Is it possible to get the serial-output so that I can get the ID in VB.net (or another IDE)
in the datareceived-event?

UPDATE:
Obviously I made a mistake. I just used the normal B4R snippet:

B4X:
Sub Process Globals
Private newstate as boolean
End Sub

Sub Timer1_Tick

 If onewire.Search(address) = False Then
  onewire.ResetSearch
    If newstate = True Then
      newstate= False
      Return
    Else
      Log("out")
    End If
 
 Else
  newstate = True
  Log(bc.HexFromBytes(address))
 End If

End Sub

And this is working fine. The log also sends the serialdata to the serialport
and can be read using the following VB.net snippet.


B4X:
Private buffer as string
Private Sub SerialPort1_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
buffer = SerialPort1.ReadLine()
Me.BeginInvoke(New EventHandler(Of SerialDataReceivedEventArgs)(AddressOf txtreceived), New Object() {sender, e})
End Sub

Private Sub txtreceived(sender As Object, e As EventArgs)
TextBox1.AppendText("ID: " & buffer & vbCrLf)
End Sub

Thank you very much in advance.
h725
 
Last edited:

h725

Active Member
Licensed User
Longtime User
I just want to get the ID from the onewire device e.g. in the windows editor. I am not sure
if the designation is correct - I want to use it as a "HID-Device".
 
Upvote 0
Top