Don't know for sure at 100% but haven't found Modulo Operator on B4R (strange as Arduino includes this operator)
So I attached how to calc Modulo between two numbers (does not work for Floats - https://www.arduino.cc/en/Reference/modulo) with Inline C
So I attached how to calc Modulo between two numbers (does not work for Floats - https://www.arduino.cc/en/Reference/modulo) with Inline C
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private Result, N1, N2 As ULong
Public Timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
N1 = 100
N2 = 10
Timer1.Initialize("timer1_Tick",1000)
Timer1.Enabled=True
End Sub
Sub Timer1_Tick
N1=N1+1
RunNative("Modulo", Null)
Log("N1= ",N1," N2= ",N2," Result: ", Result )
End Sub
#if C
void Modulo (B4R::Object* o) {
//lower case variables
b4r_main::_result = b4r_main::_n1 % b4r_main::_n2;
}
#End if