#include <Kamer.h>
#include <stdlib.h>
#include <math.h>

#define _USE_MATH_DEFINES

// Library for "Kamer"
// by Kenneth van Ewijk <http://www.kennyboy.nl>

// Demostrates how to do something with the Kamer library

// Created 16 February 2014

Kamer slaapkamer = Kamer();
int volume;
int temp;
int surfaceArea;
int outsideTemp;
int timer;
int dag = 0;
int rd = rand();
int eq;
int amp;

void setup()
{
	timer = 0;
	slaapkamer.setVolume(40);
	slaapkamer.setTemp(21);
	slaapkamer.setSurfaceArea(15, 3);
}

void loop()
{
	int uur = timer / (3600);
	int newdag = uur / 24;

	if(newdag > dag){
		rd = rand();
		dag = newdag;

		eq = 9- ((1/6) * dag) + (5 * rd);
		amp = (rd * 9) + 3;
	}

	int per = (2 * M_PI) / 24;

	outsideTemp = eq + amp * sin( per * timer);

	slaapkamer.calcTemp(outsideTemp);
	temp = slaapkamer.getTemp();

    ++timer;
  	delay(1000);
}

