Go Down

Topic: Digital pin to be set 0 (Read 359 times) previous topic - next topic

chutki

Hello all ,

I have to use the logic of reading a particular pin's status of my external µc connected with the DUE . i.e.,

1. If the pin status is 1 , send data
2. If the pin status is 0, do not send data.

What I want is , I have selected the pin 52 as input pin. I want it to be configured 0,initially . Onlly when I connect the external µc and the input pin status changes to 1 ,it should become 1.

I have tried:

 
Code: [Select]
int RDY = 52;
  int RDY_STATUS=0;

  pinMode(RDY, INPUT);
  digitalWrite(RDY,LOW);

  RDY_STATUS = digitalRead(RDY);  //the values that are printed here are always one,                     
  Serial.println(RDY_STATUS);        // [b]can this never be 0 and then later changed by i/p pin to 1.[/b]
  Serial.print("read pin");
  Serial.println(digitalRead(RDY));
  delay(1000);
  if (digitalRead(RDY) == HIGH) 
  {
 
  code continues
  }


ard_newbie

#1
Apr 13, 2018, 01:52 pm Last Edit: Apr 13, 2018, 01:53 pm by ard_newbie
 You should declare RDY pin with a pinMode(DRDY, OUTPUT) and then you can read or write to this pin.

chutki

But, the rdy pin is actually input pin to the DUE. This is like the SPI data flow control pin.
If I configure it as output ,will it still work according to the pin status it receives ?


ard_newbie


What prevents you from trying?

chutki

As I said earlier , according to the datasheet , the pin,I want to read from the external µc is supposed to be INPUT to Arduino. And I did not understand the logic of pinMode(RDY, OUTPUT).  So,I would like to know.


Go Up