{"id":20319912,"url":"https://github.com/banjerr/mothershipconnection","last_synced_at":"2026-06-12T09:31:12.998Z","repository":{"id":84220415,"uuid":"77792469","full_name":"Banjerr/MotherShipConnection","owner":"Banjerr","description":"An Arduino exercise, re-factored using Johnny-Five.js and Node.js","archived":false,"fork":false,"pushed_at":"2017-01-01T19:42:45.000Z","size":13348,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T09:32:09.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Banjerr.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-01-01T19:05:31.000Z","updated_at":"2017-01-01T19:29:41.000Z","dependencies_parsed_at":"2023-05-24T00:45:13.479Z","dependency_job_id":null,"html_url":"https://github.com/Banjerr/MotherShipConnection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Banjerr/MotherShipConnection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FMotherShipConnection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FMotherShipConnection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FMotherShipConnection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FMotherShipConnection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Banjerr","download_url":"https://codeload.github.com/Banjerr/MotherShipConnection/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Banjerr%2FMotherShipConnection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34238711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-14T18:48:25.739Z","updated_at":"2026-06-12T09:31:12.969Z","avatar_url":"https://github.com/Banjerr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MotherShip Connection\n\n![pic!](https://github.com/Banjerr/MotherShipConnection/blob/master/mothershipconnection.gif)\n\nThis came from the Arduino Uno kit, one of the first actual projects where you program anything. Since I use JavaScript quite often, I decided to try and re-factor this code using the Johnny-Five IOT Node lib. Here is the original code\n\n### original Arduino code\n\n```java\n/** THE MOTHERSHIP CONNECTION\n *  by Ben Redden\n */\n\nint switchState = 0;\n\n// the setup function runs once when you press reset or power the board\nvoid setup() {\n  // initialize digital pin LED_BUILTIN as an output.\n  pinMode(3, OUTPUT);\n  pinMode(4, OUTPUT);\n  pinMode(5, OUTPUT);\n  pinMode(2, INPUT);\n}\n\n// the loop function runs over and over again forever\nvoid loop() {\n  switchState = digitalRead(2);\n\n  if (switchState == LOW) {\n    // button isnt pressed\n    digitalWrite(3, HIGH); // green LED\n    digitalWrite(4, LOW); // red LED\n    digitalWrite(5, LOW); // red LED\n  }\n  else {\n    digitalWrite(3, LOW);\n    digitalWrite(4, LOW);\n    digitalWrite(5, HIGH);\n\n    delay(500);\n    digitalWrite(4, HIGH);\n    digitalWrite(5, LOW);\n    delay(500);\n  }\n}\n```\n\n### Johnny-Five code (probably couldve been written more elegantly)\n\n```javascript\n'use strict'\n/** THE MOTHERSHIP CONNECTION\n *  by Ben Redden\n */\n\nconst five = require(\"johnny-five\"),\n\tboard = new five.Board();\n\nboard.on(\"ready\", function(){\n  // create an Led on pins 3, 4 and 5\n  let red_led_one = new five.Led(4),\n\t  red_led_two = new five.Led(5),\n\t\tgreen_led = new five.Led(3),\n\t\tignition_switch = new five.Switch(2);\n\n\t// the green light is on (HIGH)\n\tgreen_led.on();\n\t// red led is off (LOW)\n\tred_led_one.off();\n\tred_led_two.off();\n\n  // do cool stuff when the switch is closed\n\tignition_switch.on(\"close\", function() {\n\t\t// turn the green off\n\t\tgreen_led.off();\n\t\t// make the red led blink fater\n\t\tred_led_one.blink(325);\n\t\tred_led_two.blink(325);\n\t});\n\n\t// do the opposite when you release the switch\n\tignition_switch.on(\"open\", function() {\n\t\t// turn em all off, except the green.. turn that back on\n\t\tgreen_led.on();\n\t\tred_led_one.stop().off();\n\t\tred_led_two.stop().off();\n\t});\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanjerr%2Fmothershipconnection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbanjerr%2Fmothershipconnection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbanjerr%2Fmothershipconnection/lists"}