i have problems with getting back data from a library-call to PIGPIO-Library and i2cReadDevice.
Library: The pigpio library
The library itself works and simple calls (only with uinteger and not with ByRef) works fine.
But when i try to exchange data (referenced with ByRef) it is not working:
Method Name: i2cReadDevice Parameters: i2chandle as uinteger, byref value as ptr, count as uinteger Return-Type: Integer Scope: Protected
Dim DebugString As String Dim i As Integer Dim r As Integer Dim Handle As Integer Dim DataBuffer As New MemoryBlock(256) Dim DataBufferPtr As ptr = DataBuffer ' Open I2CDevice Handle=PIGPIO.i2cOpen(1,8) ' Read data from I2C-Device If Handle >=0 Then r = pigpio.i2cReadDevice(Handle, DataBufferPtr, 11) DebugString= "R="+Str(r)+" " End If ' Close Device r=PIGPIO.i2cClose(Handle) ' Display result on GUI For i=0 To 10 DebugString=DebugString+Str(DataBuffer.Byte(i))+" " Next i MainWindow.Label1.Text=DebugString
But problem: The DebugString contains only 256 times a null (0x00h), even i get back correct "r-value" and the operation on I2C-bus is executed correctly. When i do a debug (remote-debug) and stop after the call, the MemoryBlock contains also 256 bytes of 0x00h
I think i make a mistake with pointer, it's not clear to me how to use correctly.
Can anyone help me?