Sub Process_Globals
Public Serial1 As Serial
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Dim tc_f As Float = RunNative("read_tc_f",Null)
'// For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
Dim tc_c As Float = RunNative("read_tc_c",Null)
Log("Temp:[C]: ",tc_c)
Log("Temp:[F]: ",tc_f)
End Sub
#if C
#include "max6675.h"
int thermoDO = 4;int thermoCS = 5;int thermoCLK = 6;
B4R::Object res;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
B4R::Object* read_tc_f (B4R::Object* o) {
return res.wrapNumber(thermocouple.readFahrenheit());
}
B4R::Object* read_tc_c (B4R::Object* o) {
return res.wrapNumber(thermocouple.readCelsius());
}
#End if