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

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

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

Postby korekurik » Thu Nov 21, 2013 4:48 pm

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?
korekurik
Greenhorn
 
Posts: 3
Joined: Thu Nov 21, 2013 4:41 pm

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby robosang » Thu Nov 21, 2013 5:48 pm

Show some photos of the connection, please. Also the code.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby korekurik » Sat Nov 23, 2013 11:16 pm

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!
korekurik
Greenhorn
 
Posts: 3
Joined: Thu Nov 21, 2013 4:41 pm

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby robosang » Mon Nov 25, 2013 10:07 am

Show us what you did, how can we imagine your code?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby korekurik » Mon Nov 25, 2013 10:38 pm

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
korekurik
Greenhorn
 
Posts: 3
Joined: Thu Nov 21, 2013 4:41 pm

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby shahrul » Sat Dec 21, 2013 10:21 pm

Don't make delay to high. It makes button scanning delay.
You easily can use counter to make the step.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: Arduino Mega + RF 4CH Remote Control Kit (Momentary)

Postby yonghui » Mon Dec 23, 2013 2:48 pm

normally after interrupt processor will return the program counter to the previously executing and stopped line of the instructions.
thanks&regards,
yh
yonghui
Moderator
 
Posts: 732
Joined: Mon Sep 28, 2009 3:27 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 39 guests

cron