Bluetooth Fernbedienung

Einen Guten wünsche ich,

Um gleich auf den Punkt zu kommen habe ich hier eine Frage...

Ich möchte eine Bluetooth Fernbedienung mit meinem Arduino Nano machen (Bin nicht sehr geübt in Arduino) [Ich habe den HC-05 Bluetooth adapter]

Ich brauche einen Taster für:
-Power
-Rauf
-Runter
-Links
-Rechts
-Lauter
-Leiser
-OK
-Zurück

Meine frage ist jetzt wenn ich die Taster definiert habe wie kann ich diese dann auslesen und ihnen die richtige Funktion zuweisen?

Danke schon einmal im voraus.

Gruß Goramig!

English:

Hello everyone.

To come to the point i want to build a bluetooth remote.
I have the arduino nano and the HC-05 bluetooth adapter (I'm not very skilled in Arduino)

I need buttons for:
-Power
-Rauf
-Runter
-Links
-Rechts
-Lauter
-Leiser
-OK
-Zurück

My question is, after i have defined the buttons how can i read them and give them the right function?

Thank you for the help

Goramig!

I think you'll get help much faster if you switched to English :slight_smile: As far as I understood your question is about "how to use a button"... Well, for starters, you need to pick a pin for your buttons:

#define Button1 4
#define Button2 5

int buttonState1 = 0;
int buttonState2 = 0;

In this example I used pins 4 and 5. Then you have to choose a pin mode:

void setup()
{
  pinMode(Button1, INPUT_PULLUP);
  pinMode(Button2, INPUT_PULLUP);
}

I used INPUT_PULLUP to minimize bouncing, you can also use simple INPUT.

Then you can start using your buttons. Here is a quick example:

void loop()
{
  buttonState1 = digitalRead(Button1);
  buttonState2 = digitalRead(Button2);

  //Here I read the states of buttons. It could be either LOW (button is pressed) or HIGH.

  if (buttonState1 == LOW)
  {
     //do something here - use a function
     while (digitalRead(Button1) == HIGH)
     {
      //the program waits for the button to be pressed again to exit the function. 
      //You can also use a function here - it will be executing in loop until you press the button.
     }
  }
}

And the same applies to Button2. Is that what you wanted to know?

Thank you a lot for your quick answer pati130013!

This really helps me!

But i think there's a problem.... i have only 13pins on my Arduino Nano and with this i'm using 2 pins for one button, but i need 9 buttons. Is there a way that i can use the Analog Pins as well for that?

PS: I editet the main post and addet an english translation to it. I hope that you can help me with it :3

Not completly sure of that, but I think it's possible.

14 - A0
15 - A1
16 - A2
17 - A3
18 - A4
19 - A5

I will try it, thank you :slight_smile: