Shop OBEX P1 Docs P2 Docs Learn Events
basic analog and digital — Parallax Forums

basic analog and digital

japerjaper Posts: 105
edited 2005-08-30 22:17 in Learn with BlocklyProp
hello
having problems in chapter 3 challenge 4
on led light on at exactly 2 volts, can get it close with truths but not close enough
would it work better as a varible?, definetly lost , any help to nudge me in the
right direction would be great

thank you

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-26 14:37
    Hello,

    ·· You should be getting a value back regarding your voltage.· You can use an IF...THEN statement to test for the upper and lower limits to turn on your LED.· It's giving a range, not an absolute value, so you don't have to be exact.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • japerjaper Posts: 105
    edited 2005-08-26 22:22
    i can use the truth value to get the light to turn on at exactly 2 volt but does not turn off
    until 2.67 volts., so decending from 5 volts the voltage will turn on at
    2.67 volt value, so as far as the challange goes this would be a failure.
    maybe some extreme math that i havent though of yet ?
    thank you for responding.
    i will try to narrow this comand using the decimal number and may try the binary number
    but no success with the binary number at all so far.
    this code will seem to be very important later, when exact position will be desireable

    thanks again
    will burn through this subroutine all day sunday.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-26 22:25
    japer,

    ·· Just re-read a little of the preceeding section and keep cracking at it.· You may realize it was easier than you thought afterward.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • japerjaper Posts: 105
    edited 2005-08-27 17:39
    I beleive you.
    " probably overthinking the problem,hey if i was a smoker, a smoke break
    would do the trick.
  • japerjaper Posts: 105
    edited 2005-08-29 20:12
    lighton:

    if (adcBits = 102 ) then 'adcBits 102 = 2.00 Volts
    High out
    else
    LOW out
    ENDIF
    RETURN

    this will turn light as per challange #4 at Exactly 2.00 Volts, But..... the tolerance are so tight that
    a subroutine will have to be added if movement was to fast on POT
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-29 21:29
    japer,

    ··· That's why you use a command like:

    lighton:

    if (adcBits·< 103 ) and (adcBits > 99) then

    High out
    else
    LOW out
    ENDIF
    RETURN

    This gives you a little breathing room.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • japerjaper Posts: 105
    edited 2005-08-30 21:46
    thanks chris'
    i see you used 2 aguments instead 3 which i was using
    still.... having problem trying to tight up the tolerance. using voltage so as it goes its a shallow victory.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-30 22:17
    japer,

    ·· That's just a clue of how to get it within a range.· There are a few other ways to do the same thing, which are more verbose, or less verbose, but I chose one I thought would be easy to understand.· Anyway, I hope that gets you on the right track.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.