Created
November 13, 2015 20:34
-
-
Save houmei/4347458b6f17de207670 to your computer and use it in GitHub Desktop.
Hamamatsu-Photonics S9705 Lx-Freq converter IC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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