New First Project

Good Morning All,

I am totally new to the Arduino world and have been tinkering around with the Mega for a litt while now. I have a project in mind but would like some input from the more experienced individuals her before I dive fully into is and get discusted because of not undersatandin the functionality of these mocrocontrollers.Here is what i am looking for and I will put it in as much detail without revealing the whole project and maybe as i go along can share the finished project with the public.

I would like to use a 4 button fr remote to control 3 inputs on the Arduino The first button on the remote will turn the Arduino on and off. The second button i want to control different code each time it is pressed up to lets say 15 times. the third button i would like to be able to reset those 15 stored button presses and return to the top of the program and lastly i want the 4 th button to control a digital pot / or maybe stepped input values meaning each time the button is pressed the value will increase by 10, and be reset by the third button.

For now i am looking for an outline to lay out these functions and will insert the code to do the functions.

dbitting:
I would like to use a 4 button fr remote to control 3 inputs on the Arduino The first button on the remote will turn the Arduino on and off. The second button i want to control different code each time it is pressed up to lets say 15 times. the third button i would like to be able to reset those 15 stored button presses and return to the top of the program and lastly i want the 4 th button to control a digital pot / or maybe stepped input values meaning each time the button is pressed the value will increase by 10, and be reset by the third button.

Receiving IR inputs is well within the capability of the Arduino.

It makes little sense to have the IR remote turn the Arduino off since the Arduino would have to be on and running to receive the ON signal. Perhaps you want OFF to switch the Arduino to a 'standby' mode where it doesn't produce outputs and doesn't respond to any signal except "ON".

Speaking of outputs, do you have any? Without any outputs your software won't have much to do.

By 'different code' do you mean 'act a certain way until some other button is pressed"?

Th Rf controller will activate a relay turning on and off the arduino. I am just concerned currently getting the layout for the switches and inserting different (code) functions meaning when i press button 2 it will step through different mini programs inside the whole program.

for example i have lets say 6 leds and each led is a different color i want to be able to press the button and control each led ( each LED would actually be a it of code outputing to digital or analog pins on the Arduino keeping in mind that the third and forth button inputs would possibly control functions in the mini code

button 1 = on/off ( nothing to do with the Arduino )
button 2:
press 1= do code A
press 2= do code B
press 3= do code C
button 3 clear button input of button 2 input and start over
button 4 do some function inside code A, B or C depending if the option is written in the mini code.

I want to have several functions of output to the same output pins of maybe different depending on how the remote will allow me to control the Arduino. the output pins can always be the same but due to possible expansion on my idea i would want to be able to write code to output to different pins based on the 4 buttin rf remote.

Ah... "fr" meant RF, not IR as I had guessed. Should not be a problem.

If you have an RF transmitter/receiver that can turn the Arduino ON/OFF then that's not something the Arduino would be doing.

You can use a basic Arduino to easily provide brightness control for 6 LED's and ON/OFF control for up to an additional 12. The Mega can control a LOT more.

What you are trying to do is fairly easy so you should go ahead and play with it.

Sorry for the typo.

I an quite capable doing the individual simple programming if lighting the LEDs. if you read the post i am only simplifing the actual part i understand and hoping that someone can give me their wisdom of tying att the single function ( mini programs ) together and controlling which on runs by button 2 of thr RF remote.

void loop()
    {
    if (RF.available())
        {
        int press = get_button_press();

        switch (press)
            {
        case 2:
            mode = (mode + 1) % MAX_MODE;
            break;
            }
        }

    switch (mode)
        {
    case 0: // Initial state
        //  Code for the first mode
        break;

    case 1:
       //  Code for the second mode
       break;

    .
    .
    .

    case MAX_MODE-1:
        // Code for the last case
        break;
        }
    }

Update:

Now i managed to get code written to provide me 17 options through Button 1 then it repeats. The problem i was running into was using delay() inside the Case statement, Thanks to Crossroads he was kind enough to point me in the right direction. That brings me to my next problem:

I want to use a 4 button rf remote but am not finding much in the way of setting up with the Arduino, I see where you communicate with another Arduino but not much detail on 433MHZ 4 channel receivers with keyfob. I purchased the RF Sheilds off Emartee but limited documentation. I also picked up a 4 channel unit with relays onboard but that setup would be a bit of over kill. I only need a unit to control 3 input pins as button swich presses.

Any Ideas?

You need to provide links to the parts you want to use. Even if there is not much documentation, it might be enough for us to help more.

he reciever link, there is also a transmitter on the same site.

an i have another one like this that has 4 relays controlled by the key fob
http://www.ebay.com/itm/4CH-4-Channel-433MHz-RF-Wireless-Remote-Control-Transmitter-Receiver-/130598499125?pt=AU_Electronics_Accessories_Remote_Controls&hash=item1e6846f335

I have messed about with some of the stuff from RF solutions. I was going to make a wireless RGB LED controller. I have got a 4 way decoder + encoder that you can set to latching or non-latching, which is not very helpful because I needed 2 momentary outputs, and one latching to control the power to the PIC and the PSU that runs the RGB stuff.

I didn't get around to working out how to make a latch but its on my list of to'do's!

Ok Now that i managed to get a RF controller to work in my project ( this one contains relays ) I managed to get everything working on my mega 2560 ( with a few bugs ). I now tried to reduce the size using a nano v3.1, seems now the relays switch the code on press and release so what now happens is for every press it steps two. I am baffled.

I know this may be a dumb question but can i install a flip flop circuit between the rf button signal and the digital input pin of the nano to eliminate the debounce. I think with the relays they are changing state too slow and misrepresenting the button presses

Something like this

All mechanical switches bounce, giving what appears to be multiple button presses. Here is a library that will help with any mech. switch. Arduino Playground - Bounce