I don't think possibile without additional hardware. B4A supports only Android supported hardware. You can look for modules supporting this modality. Arduino is a possibility...
Dim jo As JavaObject = Manager
Log(jo.RunMethod("getI2cBusList", Null))
Dim Name As String = "..."
Dim Address As Int = ...
Dim device As JavaObject = jo.RunMethod("openI2cDevice", Array(Name, Address))
'Now call I2cDevice methods:
Dim buffer(100) As Byte
device.RunMethod("read", Array(Buffer, Buffer.Length))
Dim data As Byte = ...
Dim reg As Int = ...
device.RunMethod("writeRegByte", Array(reg, data))
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 31 (Main)
java.lang.RuntimeException: Object should first be initialized (PeripheralManager).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at b4a.example.main._activity_create(main.java:382)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
** Activity (main) Resume **
Pls find an I2C example attached.
The BH1750 Digital Light Intensity Sensor is directly connected to the Raspberry Pi. Read the source for details. incl. pin mapping.
the working I2C example attached.
The SHT Sensor is directly connected to the Raspberry Pi.
Thanks to Robert ,he wrote most of the Code, to help me to get it work