Arduino has many sensors while RPi is somehow limited, while RPi can run server tasks, so I decided to use them both - Arduino will send the results of its program to the RPi using the USB cable using Serial print commands and the RPi will use the data as a server.
Implementation was not so simle...
I looked at Erels RPXBee example https://www.b4x.com/android/forum/t...ation-between-android-and-raspberry-pi.62564/ and copied the part of getting the serial port and the stream:
Connected the Pi and Arduino and ran the program, got these logs:
Any idea what the problem is ?
Edit: Sorry, it was just a typo in the Arduino's sketch. It works !
Implementation was not so simle...
I looked at Erels RPXBee example https://www.b4x.com/android/forum/t...ation-between-android-and-raspberry-pi.62564/ and copied the part of getting the serial port and the stream:
B4X:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
Private AST As AsyncSteamsText
Private serial As Serial
End Sub
Sub AppStart (Args() As String)
serial.Initialize("serial")
Log($"Serial ports: ${serial.ListPorts}"$)
serial.Open("/dev/ttyUSB0" )
AST.Initialize(Me, "AST", serial.GetInputStream, serial.GetOutputStream)
Log("serial port is open")
StartMessageLoop
End Sub
Private Sub AST_NewText (Text As String)
Log(Text)
End Sub
Connected the Pi and Arduino and ran the program, got these logs:
but no data came to the AST_NewTextWaiting for debugger to connect...
Program started.
Serial ports: [/dev/ttyUSB0]
serial port is open
Any idea what the problem is ?
Edit: Sorry, it was just a typo in the Arduino's sketch. It works !
Last edited: