analogRead() !- digitalRead()


hello,

i'm using "joystick breakout module shield ps2 game controller arduino" can easilly find on ebay.

i high value when i'm trying read button state...

here simplified code understand:

code: [select]

const int joy_z = 6;
void setup()
{
  pinmode(joy_z, input);
  //pinmode(joy_z, input_pullup); tried option doesn't change anything
}

loop {
  value = analogread(joy_z); //return value > 0 when button unpressed , value = 0 when button pressed

  value = digitalread(joy_z); //always return high

  delay(700);
}


i expecting use digitalread method read button pressed state.

what wrong ?

thanks lot help,

kind regards,

so analogread() work? don't make clear.

the code missing declaration joy_z.

how joystick wired? have datasheet or diagram can give us?


Arduino Forum > Using Arduino > Programming Questions > analogRead() !- digitalRead()


arduino

Comments