             }
             break;
         }
+    }
+}
+
+void temperatureTick() {
+    // called @ 1hz
+
+    // alternate between sending requests and reading temperature
+    if (!temperatureRequested) {
+        dallasTemperature.requestTemperaturesByIndex(0);
+        temperatureRequested = true;
+    } else {
+        temperature = dallasTemperature.getTempCByIndex(0);
+        temperatureRequested = false;
     }
 }
 

 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

 #include <TaskScheduler.h>

 #include "DualVNH5019MotorShield.h"
 #include "NMEASerial.h"
 #include "MessageHandler.h"
 #include "PowerConsumptionLog.h"
 #include "Roof.h"
 #include "Version.h"

#define BOARD_NAME "KOMAROOF"
#define MOTOR_POLARITY 1    // Change to -1 to invert movement direction
#define FULL_SPEED 400
#define RAMP_LENGTH 20      // two seconds

void motorTick();

static MessageHandler handler;
static NMEASerial serial(&handler);
static DualVNH5019MotorShield motorShield;
static PowerConsumptionLog powerConsumptionLog;
static Task motorTask(100, TASK_FOREVER, &motorTick);
static Scheduler taskScheduler;
static RoofState roofState = STOPPED;
static Phase phase = IDLE;
static int countSincePhase;
static int direction;

void setup() {
    Serial.begin(57600);


    taskScheduler.init();
    taskScheduler.addTask(motorTask);

    dallasTemperature.begin();
    if (dallasTemperature.getDeviceCount() > 0) {
        dallasTemperature.setWaitForConversion(false);
        dallasTemperature.setResolution(12);
        taskScheduler.addTask(temperatureTask);
    }

    motorTask.enable();
    test("");
}
