ET Sensor

8 replies [Last post]
Harrison Cassar
Title: NooBot
Joined: 10/16/2013
Posts:
BotPoints: 197
User offline. Last seen 2 years 49 weeks ago.

I need help with the ET sensor. I have tried making multiple programs to have the robot wait until a certain value is reached with the ET sensor, however I have had no luck. From the Link's sensor list, and a short program that I created, the ET sensor's reading stays relatively the same (about 860 on the Link's sensor list and 220 on the short program I created).
A short explanation of how to use the ET sensor and maybe even an example code would be great!
(Attached is the program that I created to display the ET sensor's value)

Thanks!
~Harrison

AttachmentSize
ETSensor_v1.c439 bytes
Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 2 years 35 weeks ago.

Hi Harrison,

Analog ports have two modes, "floating" and "pullup". The default is pullup, which is what light sensors and top hats use. The ET requires floating mode to have good resolution. There's a function in the Link libraries to disable pullup mode. I'm on a computer without KISS-IDE installed, so I can't check the exact name of the function, but I think it's something like "set_analog_pullups". Look in the manual for a function with a similar name; it should solve your problem.

Good luck!

PS: Sorry for the delayed reply, I was away for the weekend and didn't notice your post until now.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

Harrison Cassar
Title: NooBot
Joined: 10/16/2013
Posts:
BotPoints: 197
User offline. Last seen 2 years 49 weeks ago.

Thank you for the info! That definitely clears it up! I will try as soon as I can to incorporate this info into my example program. Once finished (or not), I will reply back to this thread to inform if it works or if I have any further questions.

Thanks again!
~Harrison

Harrison Cassar
Title: NooBot
Joined: 10/16/2013
Posts:
BotPoints: 197
User offline. Last seen 2 years 49 weeks ago.

Yes! I think I got it! Just like you said, I added the function set_analog_pullup to the beginning of the program. When I ran it, it displays at most 150 (about 1 1/2 inches from a surface) and at least 2 or 3 (really far away or touching the surface).

Thank you for all of the help!
~Harrison

P.S. Here's the code:

  1. // Created on Fri October 18 2013
  2. /* NOTES:
  3. This program is meant to display the ET Sensor's reading.
  4. Currently, this program is working, however the reading is staying realtively the same.
  5.  
  6. UPDATE:
  7. added set_analog_pullup(0,0) to change the analog reading default to "floating"
  8.   NOW the program is working fine.
  9. */
  10. int main()
  11. {
  12. set_analog_pullup(0,0); //chnges the analog to "floating" because ET sensor requires better resolution
  13. while (b_button() != 1) { //while the b_button is not pressed,
  14. display_clear(); //clear the display
  15. printf("Reading is: %d\n", analog(0)); //and display the ET Sensor's reading
  16. msleep(100); //delay the update by 0.1 seconds
  17. }
  18. }

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 2 years 35 weeks ago.

Awesome, happy to help.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

YuSheng.Chen
Title: NooBot
Joined: 10/28/2013
Posts:
BotPoints: 286
User offline. Last seen 3 years 50 weeks ago.

I'm not confused about a lot of things, but, this time, I am confused about why you used analog instead of analog10? I mean, Jeremy didn't comment on it so I must have missed something. I know that analog10 has 1024 bytes but, doesn't the ET display with 1024 bytes. And, one of the professors at USC told me to use analog10. Please reply. Thanks.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 2 years 35 weeks ago.

analog10 is higher resolution than analog (10-bit vs 8-bit), but the extra 2 bits don't usually matter. There's no harm in using analog10, and it's what I recommend, but some people use analog without any trouble.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

YuSheng.Chen
Title: NooBot
Joined: 10/28/2013
Posts:
BotPoints: 286
User offline. Last seen 3 years 50 weeks ago.

Oh, ok, thanks, I'm glad I wasn't wrong. Thanks for clearing my confusion. Relieved that I'm not missing out, lol.

panistefanin
Title: NooBot
Joined: 05/29/2017
Posts:
BotPoints: 42
User offline. Last seen 10 weeks 6 days ago.

I'm new and I'm interested in this topic. Thank you!
192.168.o.1