#include "picsys18.h"

void
setup()
{
	pinMode(CN4, OUT_BEEP) ;
}

void
loop()
{
	int v ;
	
	v = analogRead(PHOTO_SENSOR) ;
	
	if (v > 512) {
		analogWrite(CN4, 8) ;
	} else if (v > 128) {
		analogWrite(CN4, 7) ;
	} else if (v > 64) {
		analogWrite(CN4, 6) ;
	} else if (v > 32) {
		analogWrite(CN4, 5) ;
	} else {
		analogWrite(CN4, 0) ;
	}
	
	delayMilliseconds(100) ;
}
