Hi, I can't see the "val" in b4r, can someone help me?
regards
regards
inline c:
Sub Process_Globals
Public Serial1 As Serial
Private SerialStream As AsyncStreams
Private ser As B4RSerializator
Private Timer1 As Timer
Private dpin As Pin
Private ledpin = 4
' Private val1 As String ' In Globals
Private val1() As Byte ' In Globals
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
' RunNative("SerialNative2", Null)
Log("AppStart")
dpin.Initialize(ledpin,dpin.MODE_OUTPUT)
RunNative("setup1", Null)
AddLooper("mylooper")
End Sub
Sub myLooper
Dim bc As ByteConverter
RunNative("loop1", Null)
' Dim b() As Byte = bc.Trim(val1)
Dim miov As String = bc.ObjectFromBytes(val1)
Log("Resultato primo : ", miov)
Log("Resultato primo treno : ", val1)
If val1 = "H" Then
accenzione(miov)
Else
Log("nessuono Comando")
End If
Sub accenzione(mpin As String)
If mpin = "H" Then
dpin.DigitalWrite(True)
Else
dpin.DigitalWrite(False)
End If
End Sub
End Sub
#if C
char val;
void setup1(B4R::Object* o) {
Serial.begin(9600); // Start serial communication at 9600 bps
}
void loop1(B4R::Object* o) {
while (Serial.available()) { // If data is available to read,
val = Serial.read(); // read it and store it in val
}
//b4r_main::_val1->data = val;
//b4r_main::_val1->length = strlen(val);
b4r_main::_val1 = val;
// Serial.println(val);
Serial.print(val);
}
#End if