|
|
@@ -12,9 +12,12 @@ int mcu_flash_button = 0;
|
|
|
Atm_button mcubtn;
|
|
|
|
|
|
int led1_pin = 13;
|
|
|
-
|
|
|
Atm_led led1;
|
|
|
|
|
|
+int poti_pin = A0;
|
|
|
+Atm_analog poti;
|
|
|
+float shouldTemp;
|
|
|
+
|
|
|
bool wpsRunning = false;
|
|
|
|
|
|
// Init Onewire and DallasTemperature
|
|
|
@@ -48,7 +51,13 @@ void setup() {
|
|
|
thermometer.loop();
|
|
|
} )
|
|
|
.start();
|
|
|
-
|
|
|
+
|
|
|
+ poti.begin( poti_pin )
|
|
|
+ .onChange( [] (int idx, int v, int up ) {
|
|
|
+ Serial.printf("Poti: '%d'\n", v);
|
|
|
+ shouldTemp = (float)v / 20.0;
|
|
|
+ Serial.printf("ShouldTemp: %.10f\n", shouldTemp);
|
|
|
+ });
|
|
|
// sensorTimer.trace( Serial );
|
|
|
|
|
|
DS18B20Events::setup(&sensor); // Link DS18B20Events to DallasTemperature object
|
|
|
@@ -81,9 +90,12 @@ void loop() {
|
|
|
|
|
|
void temperatureChanged(uint8_t index, float tempC)
|
|
|
{
|
|
|
- Serial.print(tempC);
|
|
|
- Serial.print(" new tempC at index ");
|
|
|
- Serial.println(index);
|
|
|
+ Serial.printf("%d new tempC at index %d\n", tempC, index);
|
|
|
+ if (tempC < shouldTemp){
|
|
|
+ led1.on();
|
|
|
+ } else {
|
|
|
+ led1.off();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void wpsSetup(){
|