B4R Question Modify program to eliminate inline C

Discussion in 'B4R Questions' started by Lakshmy, Apr 12, 2019.

  1. Lakshmy

    Lakshmy New Member

    Hi,

    I am trying to extract temperature from a thinxtra xkit shield connected to an arduino. Can anyone please help me to eliminate the inline C part in the below code.



    #Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
    #End Region
    Sub Process_Globals

    Public Serial1 As Serial
    Private temperature As Float
    Private tmrTemperature As Timer

    End Sub
    Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    tmrTemperature.Initialize("tmrTemperature_Tick", 1000)
    tmrTemperature.Enabled = True
    End Sub
    private Sub tmrTemperature_Tick
    RunNative("Include",Null)
    Log(temperature)
    End Sub
    #if C
    #include <WISOL.h>
    #include <Tsensors.h>
    #include <Wire.h>
    #include <math.h>
    Isigfox *Isigfox = new WISOL();
    Tsensors *tSensors = new Tsensors();
    void Include(B4R::Object* o)
    {
    Wire.begin();
    Wire.setClock(100000);
    b4r_main::_temperature = round(tSensors->getTemp() * 10) / 10.0;
    }
    #End If
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    You will not be able to remove the inline C without writing a wrapper for this library.
     
    Lakshmy likes this.
  3. Lakshmy

    Lakshmy New Member

    Thanks Erel.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice