Shop OBEX P1 Docs P2 Docs Learn Events
Inputting frequency using an LED and photoresistor — Parallax Forums

Inputting frequency using an LED and photoresistor

D34DF007D34DF007 Posts: 4
edited 2011-01-02 21:46 in BASIC Stamp
As part of a project I'm working on, I am running a test of a certain program on my stamp, and I am trying to have my BS2 read certain frequency pulses from an LED using an photoresistor, and outputting different values in the debug terminal based on the frequency of the pulses.

for example, the LED pulses at 80 Hz, and in the debug terminal, the stamp would output the same value as "80 Hz". Ideally, I would like it to go up to the 4000 Hz range, but I'm not sure any of the stamp commands are able to read such high frequencies through a photoresistor. Can anyone help me out here?

Comments

  • ercoerco Posts: 20,256
    edited 2011-01-02 14:50
    Should work fine. Your photoresistor has a much slower response than a phototransistor; suggest you go that route. You'll use the COUNT command. Per the manual, assuming a 50% duty cycle, the input freq is limited to 125 kHz, so your 4 kHz target is a cinch.
  • D34DF007D34DF007 Posts: 4
    edited 2011-01-02 21:46
    Awesome, thanks! I'll give this a try and let you know how it goes
Sign In or Register to comment.