Skip to content
Permalink
ad529043e3
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
52 lines (41 sloc) 1.6 KB
package thermostat;
/*import com.pi4j.io.gpio.GpioController;
import com.pi4j.io.gpio.GpioFactory;
import com.pi4j.io.gpio.GpioPinDigitalOutput;
import com.pi4j.io.gpio.PinState;
import com.pi4j.io.gpio.RaspiPin;
*/
public class TemperatureActuator implements Actuatorable {
/*private final GpioController gpio = GpioFactory.getInstance();
private GpioPinDigitalOutput temperatureCoolControlActuator;
private GpioPinDigitalOutput temperatureHeatControlActuator;
*/private DataObject<Boolean> currentState;
public TemperatureActuator() {
//this.temperatureCoolControlActuator = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "TemperatureCoolControlActuator", PinState.LOW);
//this.temperatureHeatControlActuator = gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04, "TemperatureHeatControlActuator", PinState.LOW);
this.currentState = new DataObject<Boolean>(true);
}
public void setActuatorPowerPercentage(DataObject<Float> percentage) {
if(percentage.getValue() > 0.5) {
this.enterCoolingMode();
} else {
this.enterHeatingMode();
}
}
public void setActuatorValue(DataObject<Float> value) {
this.setActuatorPowerPercentage(value); //do this for use with LED demo unit
}
public DataObject<Boolean> getCurrentState(){
return this.currentState;
}
private void enterCoolingMode(){
//this.temperatureCoolControlActuator.high();
//this.temperatureHeatControlActuator.low();
this.currentState.setValue(false);
}
private void enterHeatingMode(){
//this.temperatureCoolControlActuator.low();
//this.temperatureHeatControlActuator.high();
this.currentState.setValue(true);
}
}