Skip to content

Instantly share code, notes, and snippets.

@houmei
Created November 13, 2015 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save houmei/4347458b6f17de207670 to your computer and use it in GitHub Desktop.
Save houmei/4347458b6f17de207670 to your computer and use it in GitHub Desktop.
Hamamatsu-Photonics S9705 Lx-Freq converter IC
// S9705 Lx meter
int input=5;
int high_time;
int low_time;
// float time_period;
// float frequency;
long int time_period;
long int frequency;
void setup()
{
pinMode(input,INPUT);
Serial.begin(9600);
Serial.println("Frequency Counter");
}
void loop() {
high_time=pulseIn(input,HIGH);
low_time=pulseIn(input,LOW);
time_period=high_time+low_time;
// time_period=time_period/1000;
// frequency=1000/time_period;
frequency=1000000/time_period;
// Serial.print(frequency); Serial.print(" Hz ");
// Serial.print(frequency/500); Serial.println(" Lx");
Serial.println(frequency/500);
delay(200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment