In above figure arrangement
The value of voltage for every push button serial monitor keep on changing on daily or hourly basis
How to overcome such issue ??
In above figure arrangement
The value of voltage for every push button serial monitor keep on changing on daily or hourly basis
How to overcome such issue ??
How is the project powered ?
Via USB of Laptop only blue type cable provided
Code ? Example output ?
See ….V
If the variation is a few counts, that is to be expected. Rather than expecting an absolute exact number, you need to accept ranges of values.
E.G. if you are expecting a number around 200, compare for values from 100 to 300.
Ya I sis same but next day value ranges from 400 to 600 then sometimes 900 to 1100 then again 200 to 300 likewise . .
void loop() {
int val1= analogRead(A1);
Serial.println(TacIn = analogRead(A1));
//if (TacIn>=50 && TacIn<=70) // BUTTON 01 PROGRAMMER //
if (TacIn>=950 && TacIn<=1030)
{
}
else if (TacIn>=90 && TacIn<=130) // BUTTON 02 PROGRAMMER //
//else if (TacIn>=20 && TacIn<=30)
{
}
else if (TacIn>=150 && TacIn<=190) // BUTTON 03 PROGRAMMER //
{
}
else if (TacIn>=210 && TacIn<=250) // BUTTON 04 PROGRAMMER //
{
}
}
Output is varying
Telling us that to start with would have helped. It's not an interpretation error, more likely a wiring error, because your analog input is getting a full range of numbers when no button is pressed. I'd suspect that 100k resistor isn't wired, or is dead.
Ya i changed the position of 100k on bread board and ya that also varying results
So how to do proper wiring
I mean how to connect on bread board or should I go for a soldered board like something permanent switching matrix ????
It's acting as a pulldown, so increase it's effect - go to 10k, which won't have much effect on the divider chain, but more strongly 'anchors' the input when no button is pressed. Try that, anyway. If that doesn't work, switch to A1, on the off chance your A0 has been damaged.
Breadboards often have poor connections and could well be the issue .
Waggle the wires around whilst reading the values .
As said it should read zero without a switch pressed which points to bad connection.
Has the breadboard got breaks in the middle of its power rails or are they continuous ?
Ya surely ll try with 10k
And ya i tried with A0 A1 A2 A3 and so on and got same issue
Have to check it again with 10k and values around
At this point, a quick picture of your arrangement might help; Bob might be onto something, as often the power strips on breadboards have gaps.
I see ok ll check it out
Ya i am working on one side with 4 5 pish buttons only with fresh board newly bought
Ya after sometime i ll tey as climate here suddenly got cloudy with thunderbolts
Surely ll take a pic
Board is newly bought today only
Ohhkk I see
Le me follow this tonight . .