Shop OBEX P1 Docs P2 Docs Learn Events
line follower — Parallax Forums

line follower

ArchiverArchiver Posts: 46,084
edited 2004-03-03 02:26 in General Discussion
Steve-

The NIB variable "steer" may contain a value of 0 through 15. The
operator NCD when applied to a byte variable such as "lfbits" will
return a value of 0 through 8. So, yes, a NIB is four bits, but it
can hold the result of this NCD operation.

Regards,

Another Steve

On 2 Mar 04 at 20:54, Steve wrote:

> I have a question about the line follower app.
>
> A NIB is 4 bits right? How is the 5 bits of the line follower fit in
> 4 bits?
>
> ledPos VAR Nib ' LED position in lfBits
> lfBits VAR Byte ' line follower input bits
> lastBits VAR Byte ' last LF input
> steer VAR Nib ' steering control
>
> steer = NCD lfBits ' get highest "on" bit

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-03-02 20:54
    I have a question about the line follower app.

    A NIB is 4 bits right? How is the 5 bits of the line follower fit in
    4 bits?

    ledPos VAR Nib ' LED position in lfBits
    lfBits VAR Byte ' line follower input bits
    lastBits VAR Byte ' last LF input
    steer VAR Nib ' steering control

    steer = NCD lfBits ' get highest "on" bit


    am I right? I have not stuffed a bunch of debug statements in to
    find out, But I think I am right.

    Steve
  • ArchiverArchiver Posts: 46,084
    edited 2004-03-03 02:26
    got it....

    Thank you I misunderstood the NCD command.

    I thought it returned the bit value. 10000 = 16 not 5.

    thanks again

    Steve

    --- In basicstamps@yahoogroups.com, "S Parkis" <parkiss@e...> wrote:
    > Steve-
    >
    > The NIB variable "steer" may contain a value of 0 through 15. The
    > operator NCD when applied to a byte variable such as "lfbits" will
    > return a value of 0 through 8. So, yes, a NIB is four bits, but
    it
    > can hold the result of this NCD operation.
    >
    > Regards,
    >
    > Another Steve
    >
    > On 2 Mar 04 at 20:54, Steve wrote:
    >
    > > I have a question about the line follower app.
    > >
    > > A NIB is 4 bits right? How is the 5 bits of the line follower
    fit in
    > > 4 bits?
    > >
    > > ledPos VAR Nib ' LED position in lfBits
    > > lfBits VAR Byte ' line follower input bits
    > > lastBits VAR Byte ' last LF input
    > > steer VAR Nib ' steering control
    > >
    > > steer = NCD lfBits ' get highest "on" bit
Sign In or Register to comment.