#ifndef F_CPU
#define F_CPU           4000000                   // processor clock frequency
#endif


#include <avr/wdt.h>
#include <stdlib.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#include "HD44780.h"

#include "i2chw/i2cmaster.h"

#include "tsl2561/tsl2561.h"

 void wait(void)
{
//	int i;

//  for(i = 0; i < 1000; i++)
	for(unsigned char i = 0; i < 100; i++)
	_delay_ms(10);
}


int main(void)
{

    char puffer[10];
	
    double Lux1;	
	
    wait();		   
	
	lcd_init(LCD_DISP_ON);
	

	while (1) 
	{
	
//        i2c_init();	

//        tsl2561_init();
		
		lcd_clrscr();

       Lux1 = ReadLuxes();
		
//        Lux = ReadLuxes();
		
     	lcd_gotoxy(0,1);
		sprintf( puffer, "Test:%lf", Lux1 );
		lcd_puts(puffer);
		
		
//     	lcd_gotoxy(0,1);
//		sprintf( puffer, "C1L:%li", Ch1 );
//		lcd_puts(puffer);
		
		
/*		
		wait();
	
		lcd_gotoxy(0,1);
		sprintf( puffer, "Test" );
		lcd_puts(puffer);

		
     	lcd_gotoxy(9,0);
		sprintf( puffer, "C0H:%li", Ch0DataHigh );
		lcd_puts(puffer);


     	lcd_gotoxy(0,0);
		sprintf( puffer, "C0:%li", Channel0 );
		lcd_puts(puffer);
		
		
     	lcd_gotoxy(9,0);
		sprintf( puffer, "C1:%li", Channel1 );
		lcd_puts(puffer);


		
     	lcd_gotoxy(0,1);
		sprintf( puffer, "C1L:%li", Ch1DataLow );
		lcd_puts(puffer);
		
		
     	lcd_gotoxy(9,1);
		sprintf( puffer, "C1H:%li", Ch1DataHigh );
		lcd_puts(puffer);
*/		
		wait();
		   
    }
}
