{"id":20989902,"url":"https://github.com/robtillaart/troolean","last_synced_at":"2025-10-20T00:56:08.057Z","repository":{"id":45234787,"uuid":"262045140","full_name":"RobTillaart/Troolean","owner":"RobTillaart","description":"Arduino Library for a three state logic datatype supporting {True False Unknown}","archived":false,"fork":false,"pushed_at":"2024-04-13T09:14:29.000Z","size":38,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-07T18:26:57.786Z","etag":null,"topics":["arduino","boolean","tristate"],"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/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2020-05-07T12:32:50.000Z","updated_at":"2024-01-25T19:35:24.000Z","dependencies_parsed_at":"2024-04-13T10:28:59.620Z","dependency_job_id":"5eca4756-1e59-4bc0-b692-d4e7676bef86","html_url":"https://github.com/RobTillaart/Troolean","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FTroolean","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FTroolean/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FTroolean/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FTroolean/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/Troolean/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225305788,"owners_count":17453451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","boolean","tristate"],"created_at":"2024-11-19T06:26:39.198Z","updated_at":"2025-10-20T00:56:08.038Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/Troolean/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/Troolean/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Troolean/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/Troolean/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Troolean/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/Troolean.svg)](https://github.com/RobTillaart/Troolean/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Troolean/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/Troolean.svg?maxAge=3600)](https://github.com/RobTillaart/Troolean/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/Troolean.svg)](https://registry.platformio.org/libraries/robtillaart/Troolean)\n\n\n# Troolean\n\nArduino Library for a three state logic data type supporting {True False Unknown}.\n\n\n## Description\n\nTroolean is a data type that implements three state logic with the values\n{True False Unknown }\n\nLogic operators are similar to boolean and behave the same for the familiar boolean values.\n\nTrooleans can be used e.g. to indicate a value is valid, invalid or unknown to be valid or not.\nImagine a monitoring application which has different sensors e.g. temperature.\nIf the sensor is sampled less than 1 minute ago one could say the value is valid.\nIf the last sample is taken more than an hour ago it could have changed (a lot) or not.\nSo one does not know if the temperature has become invalid or not.\nBoolean logic would make it invalid, but troolean allows to state we just don't know.\nAs long as there is no urgency (need a valid value) one does not need to resample yet.\n\nSee also https://en.wikipedia.org/wiki/Three-valued_logic\n\n\n## Interface\n\n```cpp\n#include \"Troolean.h\"\n```\n\n### Constructor\n\n- **Troolean()** value is unknown.\n- **Troolean(const int8_t)** 0 = false, -1 = unknown anything else = true\n- **Troolean(const Troolean\u0026)** copy constructor.\n\n### Equality operators\n\n- **bool operator ==** equals\n- **bool operator !=** not equal\n- **operator bool()** convert to boolean.\n\n### Logical operators\n\n- **Troolean operator !  ** negation, not UNKNOWN == UNKNOWN.\n- **Troolean operator \u0026\u0026 ** AND\n- **Troolean operator || ** OR\n\n### Value operators\n\n- **bool isTrue()** if not false and if not unknown.\n- **bool isFalse()** idem.\n- **bool isUnknown()** idem.\n\n\n## Operation\n\nSee examples\n\n\n## Future\n\n#### Must\n\n- fix **isTrue()** to allow internal values to be anything except 0 and -1  (0.2.0)\n- check logical operators.\n- update documentation\n\n#### Should\n\n- add unit tests  (derive from test troolean.ino?)\n- add examples\n\n#### Could\n\n- Troolean operator \u0026\u0026=\n- Troolean operator ||=\n- bool toBool(); // returns random true/false if unknown....\n\n#### Wont\n\n- extend with don't care ?  ==\u003e four state logic ?  Foolean?\n  - =\u003e new class.\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Ftroolean","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Ftroolean","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Ftroolean/lists"}