Shop OBEX P1 Docs P2 Docs Learn Events
frequset reading — Parallax Forums

frequset reading

KARIM102KARIM102 Posts: 75
edited 2010-11-19 13:28 in Learn with BlocklyProp
Hi everybody,
I wanna know how the stamp read the Frequent input from any sensor "Ex:Flow sensor"...

Comments

  • BeanBean Posts: 8,129
    edited 2010-11-18 11:56
    Check out the COUNT command.

    Bean
  • KARIM102KARIM102 Posts: 75
    edited 2010-11-18 22:08
    yes i know the count but i would like to know how it use it???? i mean count use for count the pules, isn' it? but how actually it count them????

    thx
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2010-11-19 05:08
    Try this I have use this and work OK for starter


    [PHP]' {$STAMP BS2}
    ' {$PBASIC 2.5}
    PushBtn PIN 0 ' pushbutton on P0
    #SELECT $STAMP
    #CASE BS2, BS2E
    DurAdj CON $100 ' / 1
    #CASE BS2SX
    DurAdj CON $280 ' / 0.400
    #CASE BS2P, BS2PX
    DurAdj CON $37B ' / 0.287
    #CASE BS2PE
    DurAdj CON $163 ' / 0.720
    #ENDSELECT
    Capture CON 1000 ' 1 second This value need to be change to mach what you have
    cycles VAR Word ' counted cycles

    Main:
    DO
    COUNT PushBtn, (Capture */ DurAdj), cycles
    DEBUG CR, " ", DEC cycles, CR
    LOOP
    END[/PHP]

    I hope this helps
  • KARIM102KARIM102 Posts: 75
    edited 2010-11-19 13:28
    thx a lot body
Sign In or Register to comment.