It could be that the internal pullup is enabled for that IO pin, and/or that the POT wiper isn't going all the way to GND. Try disabling the pullup and/or jumping the analog input to GND to see if you get a lower number.

_________________Matt

Wed May 16, 2012 1:27 pm

Dennis Mabrey

Rookie

Joined: Mon May 14, 2012 3:24 pmPosts: 43

Re: Bug? Analog port SensorValue returns 15 for lowest valu

mattallen37 wrote:

It could be that the internal pullup is enabled for that IO pin, and/or that the POT wiper isn't going all the way to GND. Try disabling the pullup and/or jumping the analog input to GND to see if you get a lower number.

Matt, in my post I said the POT was ok. I hooked it up to a multimeter and it went from 0 - 5v. I also stated that I grounded out A0 and the sensor value still returned a value of 15.

If the internal pull up was enabled I would always see a sensor value of 1023 (5V). You stated I should disable the pullup but in RobotC that would be setting the sensor type to "Digital High Impedance" but that only works for digital ports and I am working with an analog port (I know Arduino analogs pins can be digital A14-A19 but that isn't supported yet in RobotC).

Without changing the wiring or anything I loaded the Arduino IDE 1.0 version of the same code and it returns 0 - 1023 as expected.

I also tried ports A0, A1 and A5. All return 15 when grounded.

Wed May 16, 2012 2:27 pm

mattallen37

Expert

Joined: Thu Sep 29, 2011 11:09 pmPosts: 184Location: Michigan USA

Re: Bug? Analog port SensorValue returns 15 for lowest valu

Did you try taking the voltage up slightly (from 0v)? What happens at the normal level it would read 15 (based on 5v reference and a 10-bit ADC, that would be 0.0732421875v)? And what about at twice that voltage?

_________________Matt

Wed May 16, 2012 4:17 pm

Dennis Mabrey

Rookie

Joined: Mon May 14, 2012 3:24 pmPosts: 43

Re: Bug? Analog port SensorValue returns 15 for lowest valu

mattallen37 wrote:

Did you try taking the voltage up slightly (from 0v)? What happens at the normal level it would read 15 (based on 5v reference and a 10-bit ADC, that would be 0.0732421875v)? And what about at twice that voltage?

Yes I took it up slightly and the sensor value did go up slightly but I didn't bother to start mapping voltage output to the sensor value.

I am wondering has anyone been reading analog pins? Are they reading properly? Will connecting the analog pin to ground produce a 0 sensor value?

I did try both the old and the newly posted firmware.

As I said earlier I did ran the following Arduino code with exact same hardware and it works perfectly. I get 0-1023 for my sensor value off A0:

I tried this, and the same is happening with me. 15-1023 on RobotC, 0-1023 on Arduino software. I'm not using a analouge sensor, per se, but a button, which should take it to both extremes, right? Anyway, I'm seeing exactly what your seeing, Dennis.

And now I've tried it with a phototransistor and confirmed it again: RobotC goes no lower than 15 (actually, I think I might've seen 14 flash by, but not sure).

EDIT: Oops. I used a phototransistor, not a photeresistor.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Last edited by NeXT-Generation on Fri May 18, 2012 11:54 pm, edited 1 time in total.

Wed May 16, 2012 6:18 pm

Dennis Mabrey

Rookie

Joined: Mon May 14, 2012 3:24 pmPosts: 43

Re: Bug? Analog port SensorValue returns 15 for lowest valu

NeXT-Generation wrote:

I'm not using a analouge sensor, per se, but a button, which should take it to both extremes, right?

Can you try just running a wire from the analog pin you are using to a GND pin. If that doesn't say 0 then nothing will.

I tried that. Same result. Although, as I mentioned before, I think I might've seen 14 flash a couple times.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Wed May 16, 2012 7:10 pm

Dennis Mabrey

Rookie

Joined: Mon May 14, 2012 3:24 pmPosts: 43

Re: Bug? Analog port SensorValue returns 15 for lowest valu

NeXT-Generation wrote:

I tried that. Same result. Although, as I mentioned before, I think I might've seen 14 flash a couple times.

If I just let it run in continuous refresh in the debugger I sometimes see it hit 14 as well but it is mostly solid at 15.

Ok well this looks like a bug unless someone can say otherwise. Thanks for confirming this. I will soon be able to run Robotc on a mega as well so I'll see if it happens there too.

Wed May 16, 2012 8:32 pm

spsantossilva

Rookie

Joined: Wed Aug 22, 2012 6:38 pmPosts: 1

Re: Bug? Analog port SensorValue returns 15 for lowest valu

I'have a UNO and the same happens where connecting directly to gnd the analogue ports read 15 not 0.On Arduino software reads 0.BUG.?!

I'have a UNO and the same happens where connecting directly to gnd the analogue ports read 15 not 0.On Arduino software reads 0.BUG.?!

Why have you revived a 4-month old topic? It's already been established that it's a bug, and the support team knows of it.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum