{"action":"created","comment":{"url":"https://api.github.com/repos/nebrius/raspi-io/pulls/comments/44879197","id":44879197,"diff_hunk":"@@ -349,10 +349,12 @@ class Raspi extends EventEmitter {\n \n   digitalWrite(pin, value) {\n     const pinInstance = this[getPinInstance](this.normalize(pin));\n-    if (pinInstance.mode != OUTPUT_MODE) {\n+    if (pinInstance.mode === INPUT_MODE && value === HIGH) {\n+      pinInstance.peripheral = new DigitalInput({ pin: this.normalize(pin), pullResistor: PULL_DOWN });\n+    } else if (pinInstance.mode != OUTPUT_MODE) {\n       this.pinMode(pin, OUTPUT_MODE);\n     }\n-    if (value != pinInstance.previousWrittenValue) {\n+    if (pinInstance.mode === OUTPUT_MODE && value != pinInstance.previousWrittenValue) {","path":"index.js","position":20,"original_position":20,"commit_id":"1765b8ba074a3cfe22e720063786e3c5657be325","original_commit_id":"1765b8ba074a3cfe22e720063786e3c5657be325","user":{"login":"andrewn","id":1762,"avatar_url":"https://avatars.githubusercontent.com/u/1762?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewn","html_url":"https://github.com/andrewn","followers_url":"https://api.github.com/users/andrewn/followers","following_url":"https://api.github.com/users/andrewn/following{/other_user}","gists_url":"https://api.github.com/users/andrewn/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewn/subscriptions","organizations_url":"https://api.github.com/users/andrewn/orgs","repos_url":"https://api.github.com/users/andrewn/repos","events_url":"https://api.github.com/users/andrewn/events{/privacy}","received_events_url":"https://api.github.com/users/andrewn/received_events","type":"User","site_admin":false},"body":"When `digitalWrite(pin, HIGH)` is called when the pin is in INPUT_MODE then the pull resistor is set but the pin remains as an INPUT. We need to guard against trying to write to the pin because this isn't possible for input pins.\r\n\r\nI could instead return out of the function after setting the pull resistor on line 353?","created_at":"2015-11-15T23:00:31Z","updated_at":"2015-11-15T23:00:31Z","html_url":"https://github.com/nebrius/raspi-io/pull/36#discussion_r44879197","pull_request_url":"https://api.github.com/repos/nebrius/raspi-io/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/comments/44879197"},"html":{"href":"https://github.com/nebrius/raspi-io/pull/36#discussion_r44879197"},"pull_request":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/nebrius/raspi-io/pulls/36","id":47396967,"html_url":"https://github.com/nebrius/raspi-io/pull/36","diff_url":"https://github.com/nebrius/raspi-io/pull/36.diff","patch_url":"https://github.com/nebrius/raspi-io/pull/36.patch","issue_url":"https://api.github.com/repos/nebrius/raspi-io/issues/36","number":36,"state":"open","locked":false,"title":"Support internal pull up","user":{"login":"andrewn","id":1762,"avatar_url":"https://avatars.githubusercontent.com/u/1762?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewn","html_url":"https://github.com/andrewn","followers_url":"https://api.github.com/users/andrewn/followers","following_url":"https://api.github.com/users/andrewn/following{/other_user}","gists_url":"https://api.github.com/users/andrewn/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewn/subscriptions","organizations_url":"https://api.github.com/users/andrewn/orgs","repos_url":"https://api.github.com/users/andrewn/repos","events_url":"https://api.github.com/users/andrewn/events{/privacy}","received_events_url":"https://api.github.com/users/andrewn/received_events","type":"User","site_admin":false},"body":"Arduino supports enabling of pull up resistors by writing HIGH to an input pin. This is useful for buttons and is used by the [Johnny-Five Button class](https://github.com/rwaldron/johnny-five/blob/4ae32d/lib/button.js#L31-L34).\r\n\r\nSince [some Raspberry Pi GPIO pins](http://wiringpi.com/pins/special-pin-functions/) have configurable pull up and down resistors, this change enables configuring pull up resistors in the same way.","created_at":"2015-10-12T08:55:01Z","updated_at":"2015-11-15T23:00:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a8adb4d08abad552a767da3d670c676ac967325","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nebrius/raspi-io/pulls/36/commits","review_comments_url":"https://api.github.com/repos/nebrius/raspi-io/pulls/36/comments","review_comment_url":"https://api.github.com/repos/nebrius/raspi-io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nebrius/raspi-io/issues/36/comments","statuses_url":"https://api.github.com/repos/nebrius/raspi-io/statuses/1765b8ba074a3cfe22e720063786e3c5657be325","head":{"label":"andrewn:support-internal-pull-up","ref":"support-internal-pull-up","sha":"1765b8ba074a3cfe22e720063786e3c5657be325","user":{"login":"andrewn","id":1762,"avatar_url":"https://avatars.githubusercontent.com/u/1762?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewn","html_url":"https://github.com/andrewn","followers_url":"https://api.github.com/users/andrewn/followers","following_url":"https://api.github.com/users/andrewn/following{/other_user}","gists_url":"https://api.github.com/users/andrewn/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewn/subscriptions","organizations_url":"https://api.github.com/users/andrewn/orgs","repos_url":"https://api.github.com/users/andrewn/repos","events_url":"https://api.github.com/users/andrewn/events{/privacy}","received_events_url":"https://api.github.com/users/andrewn/received_events","type":"User","site_admin":false},"repo":{"id":44070993,"name":"raspi-io","full_name":"andrewn/raspi-io","owner":{"login":"andrewn","id":1762,"avatar_url":"https://avatars.githubusercontent.com/u/1762?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewn","html_url":"https://github.com/andrewn","followers_url":"https://api.github.com/users/andrewn/followers","following_url":"https://api.github.com/users/andrewn/following{/other_user}","gists_url":"https://api.github.com/users/andrewn/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewn/subscriptions","organizations_url":"https://api.github.com/users/andrewn/orgs","repos_url":"https://api.github.com/users/andrewn/repos","events_url":"https://api.github.com/users/andrewn/events{/privacy}","received_events_url":"https://api.github.com/users/andrewn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andrewn/raspi-io","description":"An IO plugin for Johnny-Five that provides support for the Raspberry Pi","fork":true,"url":"https://api.github.com/repos/andrewn/raspi-io","forks_url":"https://api.github.com/repos/andrewn/raspi-io/forks","keys_url":"https://api.github.com/repos/andrewn/raspi-io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andrewn/raspi-io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andrewn/raspi-io/teams","hooks_url":"https://api.github.com/repos/andrewn/raspi-io/hooks","issue_events_url":"https://api.github.com/repos/andrewn/raspi-io/issues/events{/number}","events_url":"https://api.github.com/repos/andrewn/raspi-io/events","assignees_url":"https://api.github.com/repos/andrewn/raspi-io/assignees{/user}","branches_url":"https://api.github.com/repos/andrewn/raspi-io/branches{/branch}","tags_url":"https://api.github.com/repos/andrewn/raspi-io/tags","blobs_url":"https://api.github.com/repos/andrewn/raspi-io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andrewn/raspi-io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andrewn/raspi-io/git/refs{/sha}","trees_url":"https://api.github.com/repos/andrewn/raspi-io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andrewn/raspi-io/statuses/{sha}","languages_url":"https://api.github.com/repos/andrewn/raspi-io/languages","stargazers_url":"https://api.github.com/repos/andrewn/raspi-io/stargazers","contributors_url":"https://api.github.com/repos/andrewn/raspi-io/contributors","subscribers_url":"https://api.github.com/repos/andrewn/raspi-io/subscribers","subscription_url":"https://api.github.com/repos/andrewn/raspi-io/subscription","commits_url":"https://api.github.com/repos/andrewn/raspi-io/commits{/sha}","git_commits_url":"https://api.github.com/repos/andrewn/raspi-io/git/commits{/sha}","comments_url":"https://api.github.com/repos/andrewn/raspi-io/comments{/number}","issue_comment_url":"https://api.github.com/repos/andrewn/raspi-io/issues/comments{/number}","contents_url":"https://api.github.com/repos/andrewn/raspi-io/contents/{+path}","compare_url":"https://api.github.com/repos/andrewn/raspi-io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andrewn/raspi-io/merges","archive_url":"https://api.github.com/repos/andrewn/raspi-io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andrewn/raspi-io/downloads","issues_url":"https://api.github.com/repos/andrewn/raspi-io/issues{/number}","pulls_url":"https://api.github.com/repos/andrewn/raspi-io/pulls{/number}","milestones_url":"https://api.github.com/repos/andrewn/raspi-io/milestones{/number}","notifications_url":"https://api.github.com/repos/andrewn/raspi-io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andrewn/raspi-io/labels{/name}","releases_url":"https://api.github.com/repos/andrewn/raspi-io/releases{/id}","created_at":"2015-10-11T21:45:10Z","updated_at":"2015-10-11T21:45:12Z","pushed_at":"2015-10-11T21:47:54Z","git_url":"git://github.com/andrewn/raspi-io.git","ssh_url":"git@github.com:andrewn/raspi-io.git","clone_url":"https://github.com/andrewn/raspi-io.git","svn_url":"https://github.com/andrewn/raspi-io","homepage":"","size":414,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nebrius:master","ref":"master","sha":"2482a3bb3747df0a78bb35f41d4e9c146e65fc9d","user":{"login":"nebrius","id":1141386,"avatar_url":"https://avatars.githubusercontent.com/u/1141386?v=3","gravatar_id":"","url":"https://api.github.com/users/nebrius","html_url":"https://github.com/nebrius","followers_url":"https://api.github.com/users/nebrius/followers","following_url":"https://api.github.com/users/nebrius/following{/other_user}","gists_url":"https://api.github.com/users/nebrius/gists{/gist_id}","starred_url":"https://api.github.com/users/nebrius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nebrius/subscriptions","organizations_url":"https://api.github.com/users/nebrius/orgs","repos_url":"https://api.github.com/users/nebrius/repos","events_url":"https://api.github.com/users/nebrius/events{/privacy}","received_events_url":"https://api.github.com/users/nebrius/received_events","type":"User","site_admin":false},"repo":{"id":24878653,"name":"raspi-io","full_name":"nebrius/raspi-io","owner":{"login":"nebrius","id":1141386,"avatar_url":"https://avatars.githubusercontent.com/u/1141386?v=3","gravatar_id":"","url":"https://api.github.com/users/nebrius","html_url":"https://github.com/nebrius","followers_url":"https://api.github.com/users/nebrius/followers","following_url":"https://api.github.com/users/nebrius/following{/other_user}","gists_url":"https://api.github.com/users/nebrius/gists{/gist_id}","starred_url":"https://api.github.com/users/nebrius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nebrius/subscriptions","organizations_url":"https://api.github.com/users/nebrius/orgs","repos_url":"https://api.github.com/users/nebrius/repos","events_url":"https://api.github.com/users/nebrius/events{/privacy}","received_events_url":"https://api.github.com/users/nebrius/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nebrius/raspi-io","description":"An IO plugin for Johnny-Five that provides support for the Raspberry Pi","fork":false,"url":"https://api.github.com/repos/nebrius/raspi-io","forks_url":"https://api.github.com/repos/nebrius/raspi-io/forks","keys_url":"https://api.github.com/repos/nebrius/raspi-io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nebrius/raspi-io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nebrius/raspi-io/teams","hooks_url":"https://api.github.com/repos/nebrius/raspi-io/hooks","issue_events_url":"https://api.github.com/repos/nebrius/raspi-io/issues/events{/number}","events_url":"https://api.github.com/repos/nebrius/raspi-io/events","assignees_url":"https://api.github.com/repos/nebrius/raspi-io/assignees{/user}","branches_url":"https://api.github.com/repos/nebrius/raspi-io/branches{/branch}","tags_url":"https://api.github.com/repos/nebrius/raspi-io/tags","blobs_url":"https://api.github.com/repos/nebrius/raspi-io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nebrius/raspi-io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nebrius/raspi-io/git/refs{/sha}","trees_url":"https://api.github.com/repos/nebrius/raspi-io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nebrius/raspi-io/statuses/{sha}","languages_url":"https://api.github.com/repos/nebrius/raspi-io/languages","stargazers_url":"https://api.github.com/repos/nebrius/raspi-io/stargazers","contributors_url":"https://api.github.com/repos/nebrius/raspi-io/contributors","subscribers_url":"https://api.github.com/repos/nebrius/raspi-io/subscribers","subscription_url":"https://api.github.com/repos/nebrius/raspi-io/subscription","commits_url":"https://api.github.com/repos/nebrius/raspi-io/commits{/sha}","git_commits_url":"https://api.github.com/repos/nebrius/raspi-io/git/commits{/sha}","comments_url":"https://api.github.com/repos/nebrius/raspi-io/comments{/number}","issue_comment_url":"https://api.github.com/repos/nebrius/raspi-io/issues/comments{/number}","contents_url":"https://api.github.com/repos/nebrius/raspi-io/contents/{+path}","compare_url":"https://api.github.com/repos/nebrius/raspi-io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nebrius/raspi-io/merges","archive_url":"https://api.github.com/repos/nebrius/raspi-io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nebrius/raspi-io/downloads","issues_url":"https://api.github.com/repos/nebrius/raspi-io/issues{/number}","pulls_url":"https://api.github.com/repos/nebrius/raspi-io/pulls{/number}","milestones_url":"https://api.github.com/repos/nebrius/raspi-io/milestones{/number}","notifications_url":"https://api.github.com/repos/nebrius/raspi-io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nebrius/raspi-io/labels{/name}","releases_url":"https://api.github.com/repos/nebrius/raspi-io/releases{/id}","created_at":"2014-10-07T06:00:02Z","updated_at":"2015-11-11T13:59:32Z","pushed_at":"2015-10-27T16:55:55Z","git_url":"git://github.com/nebrius/raspi-io.git","ssh_url":"git@github.com:nebrius/raspi-io.git","clone_url":"https://github.com/nebrius/raspi-io.git","svn_url":"https://github.com/nebrius/raspi-io","homepage":"","size":846,"stargazers_count":71,"watchers_count":71,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":4,"forks":11,"open_issues":4,"watchers":71,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/36"},"html":{"href":"https://github.com/nebrius/raspi-io/pull/36"},"issue":{"href":"https://api.github.com/repos/nebrius/raspi-io/issues/36"},"comments":{"href":"https://api.github.com/repos/nebrius/raspi-io/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nebrius/raspi-io/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/nebrius/raspi-io/statuses/1765b8ba074a3cfe22e720063786e3c5657be325"}}}}