Temperature Reader Example

Simple program to print the temperature which continually gets the current temperature fom the temperature sensor and writes the value on standard output.

// Simple program to print the temperature
 
// Interface for TempReader component
type ITempReader is interface (
    out bool tRequestChan ;
    in real tValueChan ;
    out any stdoutChan
)
 
// Temperature reader
component TempReader presents ITempReader {
 
	constructor() {
	}
 
	behaviour {
		send true on tRequestChan
		receive temp from tValueChan
		send any("\nTemp = ") on stdoutChan
		send any(temp) on stdoutChan
	}
} 
 
tr = new TempReader()
connect tr.tRequestChan to lightHumidTempSensor.tempRequest
connect tr.tValueChan to lightHumidTempSensor.tempOutput
connect tr.stdoutChan to standardOut