Pages: 1 [2] 3   Go Down
Author Topic: analog input issuses  (Read 2495 times)
0 Members and 1 Guest are viewing this topic.
Queens, New York
Offline Offline
Faraday Member
**
Karma: 65
Posts: 2925
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok you have the pull down resistor wired correctly, I'm assuming.

You don't need to make them analog unless your reading varying voltages, or resistances, I mean it will work, but you don't need it.

Just for now make the buttons and switches, digital, that way all you need to see is if it is HIGH or LOW.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok. all the digital pin are being used. and the origanal 5 that were the switches are damaged. this is y im using analog.
Logged

Queens, New York
Offline Offline
Faraday Member
**
Karma: 65
Posts: 2925
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok but, I just want you to test the buttons and switches without anything else on the arduino. When you know for sure that everything is working ,you can move them the analog pins. You need to see if you get either 1 or 255 when it is HIGH, and 0 for LOW
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could do a very simple ASCII "logical analyser".
Set all I/O pins (except pins zero and one!) to be inputs in "setup()", and enable their pullups.
In "loop()", digitalRead every pin and Serial.print its value as one or zero, and at the end of "loop()", call "Serial.println()" so all the results are on a single line.
As the program is running, simply ground a pin at a time, and check that the display in the serial monitor reflects this.
This program shouldn't be more than a dozen or so lines.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey guys thanks for the advice i did the serialwrite thing to check if its picking up the inputs. and when i run the simple sketch it picks up all the buttons .
but when i put the end cct together it will not pick up the start stop button. but picks up all the others?
any ideas?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
any ideas?
Post code.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

its the code i posted at the beginning of the thread
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hey so iv figured out that the problem is not hardware. its in the sketch. iv stared at it for hours and cant figure out what the problem is. can some one take a look?
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then how did you determine that it is software not hardware?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
const int startPin = A0; //input for begin button
void setup ()
{
  pinMode(startPin, INPUT);
  Serial.begin(9600);
}

void loop ()
{
  Serial.println (digitalRead (startPin));
}

What does that do? (uncompiled, untested)

What is connected to digital pin 2?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i loaded the sketch and all buttons work. cept the start button.
so i changed the sketches buttons allocations, so changed the start and up around.
same story. what used to be the start buttons works now to increase the values,
but it still wont start when you press the new start button

hope that makes sense
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
other thing you should probly know is that i made a boo boo and stuck 9v threw the 5 inputs this is y im trying to use the analog input.
silly me.
Uh-oh!
You're assuming that the interrupt functionality of pin 2 transfers to A0?
Sorry.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ya the sketch didnt have a wake up function to wake the camera up after longer intervals so was goin to make pin 2 the wake up pin.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so any ideas
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24308
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Use pin change interrupts, or replace the processor are the first two that spring to mind.
The second is my favourite.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: 1 [2] 3   Go Up
Jump to: