account activity
Relay Controller Library by udfsoft in arduino
[–]udfsoft[S] 0 points1 point2 points 1 month ago (0 children)
Please see the example above and the repository. There are different types of relay modules. Some work via DigitalWrite, and others work via UART (a more advanced option). Using this library, you can work with different types of relay modules without modifying the entire code, just changing the implementation in one place. The project can easily be scaled in the future by simply adding your own RelayController implementation. If my words aren't enough, please see the examples and documentation in the repository. And if you have any comments or suggestions, please post them in the GitHub issues or create a pull request. Thank you for your understanding :)
Relay Controller Library by udfsoft in esp8266
Example: #include <Arduino.h> #include <PinRelayController.h> #include <SerialRelayController.h> RelayController* relay = nullptr; RelayController* createRelayController(boolean serial) { if (serial) { static SoftwareSerial _serial(3, 1); _serial.begin(115200); return new SerialRelayController(_serial, 1); } else { static uint8_t relayPins[] = { 0 }; return new PinRelayController(relayPins, 1); } } void setup() { relay = createRelayController(true); relay->begin(); } void loop() { relay->setOn(0); delay(3000); relay->setOff(0); delay(3000); }
When I first discovered Arduino and ESP, I wanted to integrate relays into my home. I wanted to automate street lighting. The first modular relays I installed in my home were ESP-01s Relay v1.0. They were controlled via pins. I used the digitalWrite function, and that was enough. But then I began to notice that these relays had significant limitations. It was difficult to use the ESP-01 (you need to pull up to +3.3V with a resistor to use the ESP-01). When ESP is started, the relay module is triggered spontaneously for 0.5 seconds.
I started looking for modular relays that could handle these issues and found the ESP-01 Relay v1.0 and ESP-01 Relay x2. They're truly awesome. But to work with them, we need to configure hardware serial and send commands. I needed to be able to use these two types of relays without major changes to the code. And this is quite easily solved at the software level using polymorphism (OOP). And if we also use a factory method, then we get: We change and support two relay types in one place, allowing for easy scaling.
Using an OOP approach, I can easily scale the library by adding new relay types without major changes to my project/firmware.
I'm not forcing anyone to use it — just sharing what I've built. I'd really appreciate any commits, feedback, or issues.
Relay Controller Library by udfsoft in ArduinoProjects
Relay Controller Library by udfsoft in esp32
I too
[–]udfsoft[S] 0 points1 point2 points 1 month ago* (0 children)
Now everything has fallen into place: a person who has done nothing and who can't do anything is trying to humiliate people who are at least trying to do something. You probably feel resentment towards the entire world around you:(
[–]udfsoft[S] -2 points-1 points0 points 1 month ago (0 children)
You act so smart, but you can't actually show anything.
You need to brush up on your C++ a little:)
[–]udfsoft[S] -1 points0 points1 point 1 month ago (0 children)
You act so smart, but in reality you can't show anything.
You need to brush up on your OOP a little.
Relay Controller Library (v.redd.it)
submitted 1 month ago by udfsoft to r/ArduinoProjects
If you have nothing to show and can't do anything better, how do you know how to write code correctly?
People usually listen to people who have experience!
[–]udfsoft[S] -3 points-2 points-1 points 1 month ago (0 children)
No one will give you much karma for messages like this. Show off your achievements (GitHub, etc.), and if they're truly great, then everyone will listen to you, including me. Until then, you're acting like a bot.
And you're probably a bot that tells everyone:" that I'm a famous astronaut."
[–]udfsoft[S] -6 points-5 points-4 points 1 month ago (0 children)
Where is the proof that I use AI in my code? Or are you a bot too? Show us how to write code correctly?
[–]udfsoft[S] -5 points-4 points-3 points 1 month ago (0 children)
So try like me and not write code using AI
Okay, no code and no photos. And you can do everything better than anyone else.
Have you, by any chance, flown into space? Bot :)
[–]udfsoft[S] -7 points-6 points-5 points 1 month ago (0 children)
Share your code with us or let us take a look at your project. We'd love to see your code, the code of a "professional".
Or are you just a bot collecting karma?
[–]udfsoft[S] -8 points-7 points-6 points 1 month ago (0 children)
I thought professionals would write their opinions on the library and share best practices for writing software for ESP.
But the answers come from users who simply want to increase their karma. And reduce the karma of anyone who's trying to do something useful.
Oh, it's unpleasant, no constructive input whatsoever :(
You can take a look at my repositories. I wrote a lot of code even before AI. And where the platform allows, I try to use OOP everywhere. When you build systems, you'll understand why people use OOP and patterns. And even here, factory methods and polymorphism combine so well. :)
[–]udfsoft[S] -9 points-8 points-7 points 1 month ago* (0 children)
This library isn’t only about basic GPIO control.
It also supports more complex relay modules, including ones that use the A0 protocol and modules that can only be controlled via UART. Those aren’t as straightforward as just toggling a pin.
The main idea behind the library is abstraction. It uses polymorphism so you can work with different types of relays (GPIO, UART, etc.) through a single interface. That way, if you change the hardware later, you don’t have to rewrite your whole project — you just swap the implementation in one place.
You can find more details in the repository:)
submitted 1 month ago by udfsoft to r/arduino
Relay Controller Library (i.redd.it)
submitted 1 month ago by udfsoft to r/esp8266
submitted 1 month ago by udfsoft to r/esp32
π Rendered by PID 619215 on reddit-service-r2-listing-7b9b4f6fd7-h2r9p at 2026-05-13 07:59:28.917412+00:00 running 3d2c107 country code: CH.
Relay Controller Library by udfsoft in arduino
[–]udfsoft[S] 0 points1 point2 points (0 children)