#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("Counting pulses during a fixed time")
RunNative("setup",Null)
Delay(100)
AddLooper("Looper1")
End Sub
Private Sub Looper1
RunNative("loop",Null)
End Sub
#if C
#include <FreqCount.h>
void setup(B4R::Object* o){
FreqCount.begin(1000); // Gate intervall 1000 ms
}
void loop(B4R::Object* o){
if (FreqCount.available()) {
unsigned long count = FreqCount.read();
Serial.println(count);
}
}
#End if