{"id":21455052,"url":"https://github.com/samuelnoesslboeck/sylo","last_synced_at":"2026-05-21T05:03:52.645Z","repository":{"id":263795682,"uuid":"869029104","full_name":"SamuelNoesslboeck/sylo","owner":"SamuelNoesslboeck","description":"A small helper library with components and sturctures frequently used in low level programming, especially with the arduino framework.","archived":false,"fork":false,"pushed_at":"2025-10-21T14:36:06.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T16:31:51.976Z","etag":null,"topics":["arduino","low-level-programming","tutorial-code","tutorials"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamuelNoesslboeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-07T15:42:53.000Z","updated_at":"2025-10-21T14:36:11.000Z","dependencies_parsed_at":"2025-01-23T13:11:53.781Z","dependency_job_id":"028db65c-04f7-4a43-94ed-93119f6b1c73","html_url":"https://github.com/SamuelNoesslboeck/sylo","commit_stats":null,"previous_names":["samuelnoesslboeck/sylo"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/SamuelNoesslboeck/sylo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelNoesslboeck%2Fsylo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelNoesslboeck%2Fsylo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelNoesslboeck%2Fsylo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelNoesslboeck%2Fsylo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamuelNoesslboeck","download_url":"https://codeload.github.com/SamuelNoesslboeck/sylo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamuelNoesslboeck%2Fsylo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33289546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T02:57:32.698Z","status":"ssl_error","status_checked_at":"2026-05-21T02:57:31.990Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","low-level-programming","tutorial-code","tutorials"],"created_at":"2024-11-23T05:10:12.189Z","updated_at":"2026-05-21T05:03:52.640Z","avatar_url":"https://github.com/SamuelNoesslboeck.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"design/logos/sylo_logo_text.png\" width=\"75%\" /\u003e\n\u003c/p\u003e\n\n---------------------------------------------------------------------------------------------------------\n\nA small helper library with components and sturctures frequently used in low level programming, especially with the arduino framework. Feel free to use the whole library or just copy single header files to use in your ardunio and co. projects. The code is not something game-breaking just snippets and stuff I frequently use, nicely packed together, documented and explained as best as I could.\n\n\n## Contents\n\nThe following topics provide some information and explaination about the contents of this library, including examples on how and when to use them!\n\n\n### 1. Timing\n\nEverything related to changing signals in a time based matter.\n\n### 1.1. `TOff` - Timer for extending signals\n\nA `TOff` timer class helps extending a signal for a set duration, here called the `phase`. It is also very handy to unite many smaller signals into one large signal, more on that in [this code tutorial](#1-clean-handling-of-an-input-button-with-serial-output). Here is an input signal and the output signal of a `TOff` timer graphed over time:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"documentation/timing/toff_timeline.svg\" width=\"90%\" /\u003e\n\u003cp\u003e\n\nThe timer takes only one argument to initialize, the `phase`. To get the output signal for a given input signal, use the `exec()` function:\n\n```cpp\n# include \"timing/toff.hpp\"\n\n// Create new TOff timer with 1000ms phase\nstatic TOff timer (1000);\n\nvoid loop() {\n    bool input = digitalRead(8);        // Example reading of input on PIN 8\n    bool output = timer.exec(input);\n}\n```\n\n### 1.2. `TOn` - Timer for delaying signals\n\nA `TOn` timer class helps delaying a signal for a set duration, here called the `phase`. It helps removing smaller disturbances in signals or can function as a kind of confirmation, that the user really wants a certain action to happen.  ere an input signal and the output signal of a `TOn` timer graphed over time:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"documentation/timing/ton_timeline.svg\" width=\"90%\" /\u003e\n\u003c/p\u003e\n\nThe timer takes only one argument to initialize, the `phase`. To get the output signal for a given input signal, use the `exec()` function:\n\n```cpp\n# include \u003ctiming/ton.hpp\u003e\n\n// Create new TOn timer with 1000ms phase\nstatic TOn timer (1000);\n\nvoid loop() {\n    bool input = digitalread(8);        // Example reading of input on PIN 8\n    bool output = timer.exec(input);\n}\n```\n\n---------------------------------------------------------------------------------------------------------\n\n### 2. Triggers\n\nTriggers help processing signals at the right time, pace or in the right context.\n\n### 2.1. `RTrig` - Rising Trigger\n\nA rising trigger activates only for a single iteration when a signal has changed from `LOW` to `HIGH`. Which can be very useful when only wanting code to execute once, even if the signal is `HIGH` (or `true`) for multiple iterations of the `loop`. (More on that in [this example](#1-clean-handling-of-an-input-button-with-serial-output))\n\nHere is the input signal with the resulting output signal of an `RTrig` graphed:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"documentation/triggers/rtrigg_timeline.svg\" width=\"70%\" /\u003e\n\u003c/p\u003e\n\nUsing the trigger is simple, just initialize it, no arguments required!\n\n```cpp\n# include \"triggers/rtrig.hpp\"\n\nstatic RTrig trigger;\n\nvoid loop() {\n    bool input = digitalRead(8);        // Example reading of input on PIN 8\n    bool output = trigger.exec(input);\n}\n```\n\n### 2.2. `FTrig` - Falling Trigger\n\nA falling trigger activates only for a single iteration when a signal has changed from `HIGH` to `LOW`. Which can be very useful when only wanting code to execute once for e.g. a kind of `onrelease()`-event of a button.\n\nHere is the input signal with the resulting output signal of an `FTrig` graphed:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"documentation/triggers/ftrigg_timeline.svg\" width=\"70%\" /\u003e\n\u003c/p\u003e\n\nUsing the trigger is simple, just initialize it, no arguments required!\n\n```cpp\n# include \"triggers/ftrig.hpp\"\n\nstatic FTrig trigger;\n\nvoid loop() {\n    bool input = digitalRead(8);        // Example reading of input on PIN 8\n    bool output = trigger.exec(input);\n}\n```\n\n## Code examples \u0026 tutorials\n\n### 1. Clean handling of an input button with serial output\n\nGiven that we have a small button at pin `8` and we want to print out a message each time we press our button, we might start with a code that looks like the following:\n\n```cpp\n# define SWITCH_PIN 8\n\nvoid setup() {\n    // Set up our serial interface\n    Serial.begin(9600);\n\n    // Set up our input switch\n    pinMode(SWITCH_PIN, INPUT);\n}\n\nvoid loop() {\n    if (digitalRead(SWITCH_PIN)) {\n        // Print the event message to our serial monitor\n        Serial.println(\"Button pressed!\");\n    }\n}\n```\n\nIf we press our button **once**, even if we only tap it, we will get something like this in our serial monitor:\n\n```\nButton pressed!\nButton pressed!\nButton pressed!\nButton pressed!\nButton pressed!\n```\n\nand when we hold the button, the microcontroller keeps printing our success message. Which is great, but what if we want to, just as an example, send a message over network to a server or do other stuff that we only want to do once? \n\nFor this case, we use a *rising trigger* or short `RTrig`! It allows us to only fire an event once, right when the signal changes to `HIGH`. Or in other words, right when we start to press the button. (See the full explaination of the `RTrig` [here](#21-rtrig---rising-trigger))\n\nUsing such a trigger is simple, we just have to import, initialize and use it like in the following snippet:\n\n```cpp\n# include \u003ctriggers/rtrig.hpp\u003e\n\n# define SWITCH_PIN 8\n\n// We initialize our trigger here\nstatic RTrig trigger;\n\nvoid setup() {\n    // Set up our serial interface\n    Serial.begin(9600);\n\n    // Set up our input switch\n    pinMode(SWITCH_PIN, INPUT);\n}\n\nvoid loop() {\n    // Process the input signal through the trigger\n    if (trigger.exec(digitalRead(SWITCH_PIN))) {\n        // Print the event message to our serial monitor\n        Serial.println(\"Button pressed!\");\n    }\n}\n```\n\nNow it does not matter anymore if we tap or hold the button, the `if`-statement will only be executed once. However there can still be some issues:\n\n1. **Our user is very angry and presses the button at a very high speed, which we do not like**  \n    As mentioned before you might have the case that you bind something like sending a message over network or similar to this button. Such processes can be very intense in terms of calculation power so you do not want to handle a lot of them in a short period of time.\n2. **Our button does not give a clean signal**\n   Sometimes when pressing a button, an incomplete closing, a kind of bouncing of the two metal connectors can occur, which causes the button to close and open rapidly a few times b. While not being dramatic in a larger time scale our microcontroller is fast enough to detect each of these connections and disconnections as signals, causing multiple events, even with the `RTrig` implemented.\n\nThis issue however can easily be fixed by using a `TOff`-timer component, as it merges mutliple signals that come in too fast into one, which we can then extract a single signal of using the already mentioned `RTrig`. The processing of the signal is graphed below: \n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"documentation/examples/1_switch_signal.svg\" width=\"90%\" /\u003e\n\u003c/p\u003e\n\n```cpp \n# include \"timing/toff.hpp\"\n# include \"triggers/rtrig.hpp\"\n\n# define SWITCH_PIN 8\n\n// We initialize our trigger here\nstatic RTrig trigger;\n// And the timer here, forcing a minimum time between inputs of 200ms\nstatic TOff timer;\n\nvoid setup() {\n    // Set up our serial interface\n    Serial.begin(9600);\n\n    // Set up our input switch\n    pinMode(SWITCH_PIN, INPUT);\n}\n\nvoid loop() {\n    // Process the input signal through the timer, then the trigger\n    if (trigger.exec(timer.exec(digitalRead(SWITCH_PIN)))) {\n        // Print the event message to our serial monitor\n        Serial.println(\"Button pressed!\");\n    }\n}\n```\n\n## Building \u0026 IDE\n\nTo build the library with platformio, simply run a platformio shell and type:\n\n```sh\npio cl --lib=\".\" --board=\"uno\" \"src\"\n```\n\nFurthermore, if you want to integrate the library properly into an IDE like VSCode, type:\n\n```sh\npio init --ide vscode\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelnoesslboeck%2Fsylo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelnoesslboeck%2Fsylo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelnoesslboeck%2Fsylo/lists"}