i have been searching for a couple of days now.
i am wondering if it is possible to use Bluetooth and a physical button/switch to be able to control a light or relays.
i want to wire up some lights and relays to buttons (possibly a keypad) but would like to add Bluetooth controller(HC05) to also be able to switch the lights/relays on or off?
if there is already a post regarding this, please feel free to direct me to it
try a web search for esp32 bluetooth leds - you should get some ideas
recommend you move to a ESP32 which has builtin WiFi, Bluetooth Classic and BLE (cost about £6 in UK) - it is supported by the arduino IDE
I'm quite sure that you can find examples how to control something using Bluetooth and you can find examples how to control something using buttons.
Next you can combine them.
The trick is to use variables to keep track of state and use that state to control the relays. The below pseudo code demonstrates
if hc05.read == 1
// toggle relay state
relayState = !relayState
if button1 changed
// toggle relay state
relayState = !relayState
// use relayState to switch relay on or off
if relayState == on
switch relay on
else
switch relay off
Sure it's possible. I'd go with @horace nice suggestion, the ESP32 would be a great develpment base.
For the physical button part I'd suggest to take a look (or use it as it is) into my mpbToSwitch library This Repository in Github. I admit I had no time to update it (refactoring it from it's STM32 big brother) but it will surely cover what you need for a project like yours.
thank you for the help and advice.
unfortunately i am not so good in coding, so i will take some time to attempt writing the code to encompass your advice, but it seems most plausible.
i will have to look into the ESP32, but to be honest i have no clue what that is yet.
i also took a look at the library you sent me, thank you very much. but i am still very much a beginner and it sounds a bit like Greek to me.
i will continue to learn with the hopes to understand
you can use Bluetooth controller(HC05) with arduino. or a esp32 which has in-built bluetooth and wifi.
just search for "arduino home automation" or "ESP32 home automation" on internet. there are penalty of tutorial about it.
But at least you will not have the problems of code not compiling because the code you found on the web was for the older V2.x board package and not for the V3.x board package or vice versa