Page 1 of 1
Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Thu Nov 21, 2013 4:48 pm
by korekurik
Hello guys. Is it possible for me to use the output from the RF module as an input to the arduino. If its possible, how can it be done. I assumed the output from the Rf module is 5v, and i tried connecting it with a 10k, 220 ohm resistor and also without any resistors, but it was unsuccessful. can somebody help me please?
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Thu Nov 21, 2013 5:48 pm
by robosang
Show some photos of the connection, please. Also the code.
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Sat Nov 23, 2013 11:16 pm
by korekurik
robosang WROTE:Show some photos of the connection, please. Also the code.
Fortunately i was able to solve the problem. I mistakenly connect the output from the RF module to ground. After solving that problem, another issue arised. I am able to interrupt the arduino (perform a simple led blinking task) using output signal from the rf module. But i need to return to a specific function after the interrupt is executed. Is it possible to do so? If possible, how can it be done?Thanks in advance!
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Mon Nov 25, 2013 10:07 am
by robosang
Show us what you did, how can we imagine your code?
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Mon Nov 25, 2013 10:38 pm
by korekurik
robosang WROTE:Show us what you did, how can we imagine your code?
- CODE: SELECT_ALL_CODE
// Flag needs to be volatile if used in an ISR
volatile int buttonFlag = LOW;
int pin1 = 1;
int pbIn = 0;
int pin3 = 3;
int pin2 = 2;
int pin4 = 4;
void setup ()
{
pinMode(pin1, OUTPUT);
attachInterrupt(pbIn, interruptservice, RISING);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
volatile int buttonFlag = 0;
}
void loop ()
{
if (buttonFlag == LOW)
{
heartbeat (); //make led beat
}
else
{
digitalWrite(pin1, HIGH); //button stays green once pushed
delay (1000); //has some other delays
digitalWrite(pin1, LOW);
delay (1000);
digitalWrite(pin4, HIGH); //button stays green once pushed
delay (1000); //has some other delays
digitalWrite(pin4, LOW);
delay (1000);
buttonFlag = 0; //clear flag after executing code
}
}
void heartbeat ()
{
digitalWrite(pin3, HIGH);
delay(500);
digitalWrite(pin3, LOW);
delay(500);
}
// Interrupt Service Routine attached to INT0 vector
void interruptservice()
{
buttonFlag = digitalRead(pin2); //set flag to value of button
}
I was managed to use the interrupt as a flag, however, is it possible to monitor 4 inputs at the same time in order to use the input to make a function executable at anytime without delay? Thanks in advance
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Sat Dec 21, 2013 10:21 pm
by shahrul
Don't make delay to high. It makes button scanning delay.
You easily can use counter to make the step.
Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Posted:
Mon Dec 23, 2013 2:48 pm
by yonghui
normally after interrupt processor will return the program counter to the previously executing and stopped line of the instructions.