Permalink
Cannot retrieve contributors at this time
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?
Thermocontroller/src/thermostat/TemperatureActuator.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
52 lines (41 sloc)
1.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |