Shop OBEX P1 Docs P2 Docs Learn Events
light to frequency convert code question — Parallax Forums

light to frequency convert code question

science_geekscience_geek Posts: 247
edited 2009-01-11 08:10 in Propeller 1
i am using the frequency to light converter from parallax, i am using the code from obex, and i have the output variable sent to a small display from 4d systems, one thing that i would like to do is to do a pwm so that when the sensor reads a certain intensity, it would adjust the pwm for a small high output led, one problem with this though, the higher the intensity the higher the frequency, if i were to bring the frequency down to a reasonable level (say between 0 and 256 like used in the pwm tutorials) it would still be "backwards", how can i invert the variable so that a lower light intensity would result in a lower pwm frequency.

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2009-01-11 08:10
    You invert the value by subtracting the measured value from·the maximum value.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
Sign In or Register to comment.