{"id":28999967,"url":"https://github.com/ripred/smartpin","last_synced_at":"2026-04-24T11:35:20.068Z","repository":{"id":237629765,"uuid":"794920572","full_name":"ripred/SmartPin","owner":"ripred","description":"Experimenting with the idea of an object-oriented pin class that uses operator overloading to intuitively abbreviate the usage of digitalRead(...), digitalWrite(...), analogRead(...)  and analogWrite(...)","archived":false,"fork":false,"pushed_at":"2024-05-02T11:22:09.000Z","size":62,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-02T21:48:20.664Z","etag":null,"topics":["arduino","arduino-library","embedded","hardware","intuitive","object-oriented-programming","operator-overloading"],"latest_commit_sha":null,"homepage":"https://github.com/ripred/SmartPin","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/ripred.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}},"created_at":"2024-05-02T08:18:44.000Z","updated_at":"2024-05-02T21:48:33.820Z","dependencies_parsed_at":"2024-05-02T21:48:31.055Z","dependency_job_id":"715d3b2a-c00e-435b-923f-1e8c459157de","html_url":"https://github.com/ripred/SmartPin","commit_stats":null,"previous_names":["ripred/smartpin"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ripred/SmartPin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripred%2FSmartPin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripred%2FSmartPin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripred%2FSmartPin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripred%2FSmartPin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ripred","download_url":"https://codeload.github.com/ripred/SmartPin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ripred%2FSmartPin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261838334,"owners_count":23217616,"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","arduino-library","embedded","hardware","intuitive","object-oriented-programming","operator-overloading"],"created_at":"2025-06-25T08:41:10.919Z","updated_at":"2026-04-24T11:35:20.025Z","avatar_url":"https://github.com/ripred.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/ripred/SmartPin/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/ripred/SmartPin/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/ripred/SmartPin/actions/workflows/arduino-lint.yml)\n![code size:](https://img.shields.io/github/languages/code-size/ripred/SmartPin)\n[![GitHub release](https://img.shields.io/github/release/ripred/SmartPin.svg?maxAge=3600)](https://github.com/ripred/SmartPin/releases)\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ripred/SmartPin/blob/master/LICENSE)\n[![Stars](https://img.shields.io/github/stars/ripred/SmartPin.svg?style=flat-square\u0026colorB=4183c4)](https://github.com/ripred/SmartPin)\n[![Forks](https://img.shields.io/github/forks/ripred/SmartPin.svg?style=flat-square\u0026colorB=4183c4)](https://github.com/ripred/SmartPin)\n\n# Arduino SmartPin Library\n\n\n\n### Example\n\n```cpp\n/*\n * SmartPin.ino\n * \n * Experimenting with the idea of an object-oriented pin class\n * that uses operator overloading to intuitively abbreviate the \n * usage of digitalRead(...), digitalWrite(...), analogRead(...)\n * and analogWrite(...)\n * \n * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n * example 1\n * \n *    SmartPin button(2, INPUT_PULLUP);\n *    SmartPin led(3, OUTPUT);\n * \n *    void loop() {\n *        led = !button;\n *        ...\n *    }\n * \n * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n * \n * example 2\n * \n *    SmartPin potentiometer(A0, INPUT, analogWrite, analogRead);\n *    SmartPin led(3, OUTPUT, analogWrite);\n * \n *    void loop() {\n *        led = potentiometer / 4;\n *        ...\n *    }\n * \n * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n * \n */\n#include \u003cSmartPin.h\u003e\n\nenum MagicNumbers {\n    // project-specific pin usage; Change as needed\n    BUTTON_PIN =  2,        // a digital input pin wth a push button\n    POT_PIN    = A0,        // an analog input pin with a potentiometer\n    LED1_PIN   =  3,        // a digital output pin to follow the button\n    LED2_PIN   =  5,        // a pwm output pin to follow the potentiometer value\n\n};  // enum MagicNumbers\n\n// a push button that drives an LED\nSmartPin  button_pin(BUTTON_PIN, INPUT_PULLUP);\nSmartPin  led1_pin(LED1_PIN, OUTPUT);\n\n// a potentiometer that drives the PWM brightness of an LED\nSmartPin  pot_pin(POT_PIN, INPUT, analogWrite, analogRead);\nSmartPin  led2_pin(LED2_PIN, OUTPUT, analogWrite);\n\nvoid setup()\n{\n    // example LED fade in/out using simple integer assignment\n    for (int i=0; i \u003c 4; i++) {\n        for (int pwm=0; pwm \u003c 256; pwm += 4) {\n            led2_pin = pwm;\n            delay(4);\n        }\n        for (int pwm=255; pwm \u003e= 0; pwm -= 4) {\n            led2_pin = pwm;\n            delay(4);\n        }\n    }\n}\n\nvoid loop()\n{\n    // using the pins is ridiculously easy 😎:\n    led1_pin = !button_pin;   // we invert the HIGH/LOW value since the button is active-low\n    led2_pin = pot_pin / 4;   // set the led brightness relative to the potentiometer value\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fripred%2Fsmartpin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fripred%2Fsmartpin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fripred%2Fsmartpin/lists"}