nRF24 / RF24Audio

Arduino library for streaming data/audio from analog inputs via NRF24L01 modules
http://nrf24.github.io/RF24Audio
260 stars 88 forks source link

Customize Buttons #5

Closed vetRalph closed 9 years ago

vetRalph commented 9 years ago

Why is it when I disable the button handing it (my term) kills all the pins. For example, I have an external LED connected to pins 2 & 3 that activates when I start transmitting. Pins 2 & 3 are not used by the Minimal example but when I disable button handling they no longer work. Seeing these pins are not used, it seems to me, they should not be effected but that is not the case. In fact it seems to affect all the pins.

Even if I try to reprogram the pins they still don't work.

Thanks Ralph

TMRh20 commented 9 years ago

Sorry about the delay, but I'm not really sure on this one, since disabling button handling shouldn't affect the pin outputs. Are you still setting the pins to output?

vetRalph commented 9 years ago

No problem. I can't believe you spend this much time helping everyone.

Here is the Sketch I used to test it. I am using the same pins except the Start_LED and Trig_LED pins. Once I disabled pin handling taking the TX_PIN low no longer turns the LED on or starts transmit. I hope this is enough info.

I am kind of new at this so I could have something wrong.

include

include

include

RF24 radio(7,8);
RF24Audio rfAudio(radio,0);

define TX_PIN A1

define VOL_UP_PIN A2

define VOL_DN_PIN A3

define REMOTE_TX_PIN A4

define REMOTE_RX_PIN 4

define Start_LED 3

define Trig_LED 2

                              .

void setup() {

pinMode(TX_PIN,INPUT_PULLUP); pinMode(VOL_UP_PIN,INPUT_PULLUP); pinMode(VOL_DN_PIN,INPUT_PULLUP); pinMode(REMOTE_TX_PIN,INPUT_PULLUP); pinMode(REMOTE_RX_PIN,INPUT_PULLUP);

pinMode(Start_LED,INPUT_PULLUP); pinMode(Trig_LED,OUTPUT);

rfAudio.begin(); . rfAudio.setVolume(7);

}

void loop() {

if(digitalRead(TX_PIN)){ rfAudio.transmit(); digitalWrite(Start_LED,HIGH); } else { rfAudio.receive(); digitalWrite(Start_LED,LOW); }

Second test: This worked before disabling button handling. Did not work with button handling disabled. void loop()

{

if(digitalRead(Start_LED)){ digitalWrite(Trig_LED,LOW; } else { digitalWrite(Trig_LED,HIGH); }

TMRh20 commented 9 years ago

"I can't believe you spend this much time helping everyone."

Neither can I...

In double checking the code, there is just no possible way for manual button handling to affect pin outputs. There are numerous problems with your code, but I don't do tech. support, so the best I can do is to say check your inputs/outputs and don't call library functions thousands of times per second.

vetRalph commented 9 years ago

OK, Thanks. I will check it out.

Ralph