Sub Process_Globals
Public Serial1 As Serial
Private n1 , n2 As Boolean
Private P5,P6 As Pin
Private LEN As Int
Private pinreg As UInt
Private TT As Long
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
P5.Initialize(5,P5.MODE_INPUT_PULLUP)
P6.Initialize(6,P6.MODE_INPUT_PULLUP)
LEN = 10000
Log("test 1 digitalRead ")
TT = Millis
For a=1 To LEN
n1 = P5.DigitalRead
n2 = P6.DigitalRead
Next
Log("time to run ",Millis-TT,"ms")
Log(n1,n2)
Delay(1000)
Log("test 2 PIND register ")
TT = Millis
For a=1 To LEN
RunNative("readpin",Null)
Next
Log("time to run ",Millis-TT,"ms")
Log(Bit.Get(pinreg,5),Bit.Get(pinreg,6))
Delay(7000)
End Sub
#if C
void readpin (B4R::Object* o) {
//use lower case variables
b4r_main::_pinreg = PIND;
}
#End if