Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Reading a Maximite Pin doesnt work
Author | Message | ||||
mcmichael Newbie Joined: 03/11/2013 Location: GermanyPosts: 2 |
Hi Experts, I'm trying to read values from a pin and all I'm getting are rubbish values. In the program I wrote: SETPIN 1,1 PRINT PIN(1) I connected a variable resistor (potentiometer) to GND, 5V and I/O Pin 1. The values jump from 0.1 to 0.7 and are not referenced to the input value. What am I doing wrong? Thanks, Michael |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Michael, Try SetPin 1,1 V=Pin(1) Print V Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1873 |
Michael, Your code should work the only reason I suggested the change is because it is what I have used to read the value from a temperature sensor, and it works fine. But I just had a thought, make sure you have actually connected to pin 1 it can get confusing. If pin 1 is floating you probably will get funny readings. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Pin 1 has a maximum allowed input of 3.3V. Connect your pot to 3.3, not 5V. With the readings your are getting, I agree with Paul, you have an open circuit or floating input. Jim VK7JH MMedit MMBasic Help |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
Another possibility is your Gnd reference. Are you using the Maximite Gnd and 3.3v - if not, try them. Greg |
||||
mcmichael Newbie Joined: 03/11/2013 Location: GermanyPosts: 2 |
Hello Experts, thank you vermy much for your replies - I've found the mistake. It was none of the leads you mentioned - I looked at the connection diagram the wrong way around. Now everything is fine and my joystick is working. have a good time! Bye, Michael |
||||
Print this page |