B4J Tutorial Remote control Raspberry Pi with Tablet via Bluetooth.

Based on various tutorials and posts, I have made this remote control for my RPi.
Hardware required: Tablet with 1200 x 800 resolution (can be reduced by changing the layout file) and Bluetooth, Raspberry Pi with a serial port and Bluetooth adapter

Two components are used:

1 Windsonic Server for the RPi (B4J)
2 Windsonic Client for the tablet (B4A)

I found it helpful to run the B4J file in a terminal window to see the logs.

You will need to pair the bluetooth devices first and change the MAC address in line 87 to match your device:

B4X:
txtMAC = "00:1A:7D:DA:71:0F"

Following libraries are required:
B4J
Library1=jcore
Library2=jserial
Library3=jrandomaccessfile
Library4=javaobject
Library5=jbluetooth

B4A
Library1=core
Library2=randomaccessfile
Library3=serial
Library4=javaobject

The app on the RPi just needs to be run, as it will default to debug mode and send random data.
The tablet app is explained in the code.

1. Create a new file to store data. This has the format YYYYMMDD-HHMM.txt
2. Make Bt connection
3. Start logging.

The app on the RPi can be stopped from the tablet.

My sensor is connected to the RPi com port and measures wind speed and direction.

This is my first app with B4J but definitely not my last. Its great!
 

Attachments

  • Windsonic_server.zip
    1.9 KB · Views: 452
  • winsonic_client.zip
    86 KB · Views: 482
  • windsonic_client.png
    windsonic_client.png
    36.3 KB · Views: 528
Last edited:
Top