adityanagal / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

digitalRead returns false value..? #1115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Q. What steps will reproduce the problem?
1.Pin is an Output.
2.Write value high or low to the output.(this schould be in latch PINxn?)
3.digitalRead(Pin) schould be 1 or 0 depending on step 2 - value suppose to be 
readed from latch PINxn - if pin is output

Q. What is the expected output? What do you see instead?
A. as said in step 3, value  schould be 1 or 0 depending on last outputed ... 
instead its always 1.

Q. What version of the Arduino software are you using? On what operating 
system?  Which Arduino board are you using?
A. ver 1.0.2; win7; mega 2560 with ethernet+sd shield

Please provide any additional information below.

#define ledPin23 23
pinMode(ledPin23, OUTPUT);
...
if (strstr(filename, "23-on") != 0) digitalWrite(ledPin23, LOW);
if (strstr(filename, "23-off") != 0) digitalWrite(ledPin23, HIGH);
int pinStat = digitalRead(ledPin23);
#ifdef __dbg__
    if (pinStat = 0) PgmPrint("OUT 23 status is 0 !");
    if (pinStat = 1) PgmPrint("OUT 23 status is 1 !");
#endif

pin stat is always 1...

Original issue reported on code.google.com by sq5...@gmail.com on 15 Nov 2012 at 12:36

Attachments:

GoogleCodeExporter commented 9 years ago
Dumb error, mine fault sry:

    if (pinStat == 0) PgmPrint("OUT 23 status is 0 !");
    if (pinStat == 1) PgmPrint("OUT 23 status is 1 !");
and works ok.

Original comment by sq5...@gmail.com on 15 Nov 2012 at 1:15

GoogleCodeExporter commented 9 years ago

Original comment by wes...@gmail.com on 15 Nov 2012 at 3:59