Problem with input

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Problem with input

Post by clocktower »

I can't figure out why I am unable to read the state of a particular input pin.
I'm running a Sound FX board with an Arduino Nano.
The Sound FX has an "Activity" pin that goes low when it's playing a sound.
Otherwise, the pin is high.
I have confirmed this operation with an oscilloscope.
I have tied the Activity pin to the Nano D7

#define Activity 7
pinMode(Activity, INPUT);

But when I play the track, the Nano does not seem to see the low state of Activity:

sfx.playTrack(name); // play a bell
delay(500);
if (!Activity) Serial.println("Activity");

User avatar
clocktower
 
Posts: 60
Joined: Sun May 24, 2015 3:10 pm

Re: Problem with input

Post by clocktower »

Okay, yet again I have committed a STUPID error and have found it five minutes after posting my question.

The correct code is:
if (!digitalRead(Activity)) Serial.println("Activity");

The Forum is a great help, even without replies. Just by posting a question I receive an answer from the ether...

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Problem with input

Post by Franklin97355 »

Thanks for posting your findings. I was just about to suggest a pullup resistor for the pin but am relieved you found a solution.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”