I need help with to control 4 relays with one joystick.
By HC05 Bluetooth module using arduino mega.
When it is in y axis should “bulb A” is high
When it is in x^1 axis should “bulb B” is high
When it is in x axis should “bulb C” is high
When it is in y^1 axis should “bulb D” is high
And one relay should be high at a time only!
Joystick should auto-return.
When joystick is at auto-return. All 4 relays should be low
Push the X and Y values to a variable like A and B from the joystick.
And later use comparison operators to compare value of A and B for your desired output.
This is the simplest solution i can think of !!
Can u plz explain because I didn’t understand
I am on my phone right now so i cannot explain the whole thing properly !! Let me try
You can see in the screenshot you posted :
To access the values of X and Y you can use param[0].asint(); and param[1].asint();
So if your joystick is pointing up then lets say
X == 128 and Y == 0
Then your relay or bulb A will be turned ON
If ( X == 128 && Y == 0 ) {
digitalWrite (Bulb, HIGH);
}
I hope you got what i am trying to explain. With this technique you can achieve what you you are looking for.
Should I add any libraries
I am not sure about your coding skills. I suggest you to do some research n understand about the stuff you are going to achieve.
No one will write the whole code for you here. We can give you tips tricks n ideas on how to get the thing running.
I dont understand what libraries you are talking about.
Next time you post your code that you have got so far. And later ask your doubts.
Ok I will post the code and let you know the doubt