Shop OBEX P1 Docs P2 Docs Learn Events
Question about QTI sensors and the addon kit 28108 — Parallax Forums

Question about QTI sensors and the addon kit 28108

tnbk00tnbk00 Posts: 2
edited 2015-03-18 15:18 in Accessories
Hi I have followed the instructions for the add on kit 28108 to add line following capability to my Boe-Bot.

I am using an arduino and have loaded the code example from the product page.

I am seeing some very odd behaviour. With one of the sensors the binary conversion when displaying to the terminal does a very strange thing.

For example the standard state is: (
1111

with all seeing black its
0000

If I cover the sensors one at a time from right to left I get the following output
1110 - 7 in decimal
1101 - 13 in decimal
1011 - 11 in decimal
111 - 7 in decimal but it drops the last (or the first) digit.

The final sensor for some reason does not seem to do the binary conversion correctly.

In the code I dropped the , BIN from the terminal output and it shows the correct decimal values.

I have swapped the offending QTI sensor with another one but the results are the same, which made me think maybe its the wiring or the code.

Any suggestions would be great!

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2015-03-18 14:04
    Leading zeros are often dropped when binary numbers are displayed.

    1110 is 14 not 7
    111 is 7
    0111 and 111 are the same numbers.

    From what you've described, it looks like the sensors and code are working correctly.

    I'm sure there's a way to force a leading zero if you want one displayed but I don't know off hand how to do this with an Arduino.
  • tnbk00tnbk00 Posts: 2
    edited 2015-03-18 15:18
    Thanks too true sorry for my mistake.


    The issue is that the rest of the code has case checks where it is looking for 0111 which it will never see. Ill just change what its looking for but this sure feels like something else is not right here
Sign In or Register to comment.