{"action":"created","comment":{"url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/comments/53559803","id":53559803,"diff_hunk":"@@ -0,0 +1,298 @@\n+Network\n+-------\n+\n+It is possible to connect devices together to send and receive\n+messages to and from each other. This is called a network. A network of\n+interconnected networks is called an internet. The Internet is an internet\n+of all the internets.\n+\n+Networking is hard and this is reflected in the program described below.\n+However, the beautiful thing about this project is it contains all the common\n+aspects of network programming you need to know about. It's also remarkably\n+simple and fun.\n+\n+But first, let's set the scene...\n+\n+Connection\n+++++++++++\n+\n+Imagine a network as a series of layers. At the very bottom is the most\n+fundamental aspect of communication: there needs to be some sort of way for\n+a signal to get from one device to the other. Sometimes this is done via a\n+radio connection, but in this example we're simply going to use two wires.\n+\n+.. image:: network.png\n+\n+It is upon this foundation that we can build all the other layers in the\n+*network stack*.\n+\n+As the diagram shows, blue and red micro:bits are connected via crocodile\n+leads. Both use pin 1 for output and pin 2 for input. The output from one\n+device is connected to the input on the other. It's a bit like knowing which\n+way round to hold a telephone handset - one end has a microphone (the input)\n+and the other a speaker (the output). The recording of your voice via your\n+microphone ends up played out of the other person's speaker. If you hold the\n+phone the wrong way up, you'll get strange results!\n+\n+It's exactly the same in this instance: you must connect the wires properly!\n+\n+Signal\n+++++++\n+\n+The next layer in the *network stack* is the signal. Often this will depend\n+upon the characteristics of the connection and in our example it's simply\n+digital on and off signals sent down the wires via the IO pins.\n+\n+If you remember, it's possible to use the IO pins like this::\n+\n+    pin1.write_digital(1)  # switch the signal on\n+    pin1.write_digital(0)  # switch the signal off\n+    input = pin2.read_digital()  # read the value of the signal (either 1 or 0)\n+\n+With two layers in we have a physical connection and a description of how the\n+signal will be sent. The next step involves describing how to handle a signal.\n+For that we need a...\n+\n+Protocol\n+++++++++\n+\n+If you ever meet the Queen there are expectations about how you ought to\n+behave. For example, when she arrives you may bow or curtsey, if she offers her\n+hand politely shake it, refer to her as \"your mejesty\" and thereafter as","path":"docs/lessons/network.rst","position":61,"original_position":61,"commit_id":"74b4e1616354ea3ac733330e94f2bc6abe6d09a7","original_commit_id":"74b4e1616354ea3ac733330e94f2bc6abe6d09a7","user":{"login":"carlosperate","id":4189262,"avatar_url":"https://avatars.githubusercontent.com/u/4189262?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosperate","html_url":"https://github.com/carlosperate","followers_url":"https://api.github.com/users/carlosperate/followers","following_url":"https://api.github.com/users/carlosperate/following{/other_user}","gists_url":"https://api.github.com/users/carlosperate/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosperate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosperate/subscriptions","organizations_url":"https://api.github.com/users/carlosperate/orgs","repos_url":"https://api.github.com/users/carlosperate/repos","events_url":"https://api.github.com/users/carlosperate/events{/privacy}","received_events_url":"https://api.github.com/users/carlosperate/received_events","type":"User","site_admin":false},"body":"`mejesty` -> `majesty`","created_at":"2016-02-21T00:46:04Z","updated_at":"2016-02-21T00:46:04Z","html_url":"https://github.com/bbcmicrobit/micropython/pull/212#discussion_r53559803","pull_request_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212","_links":{"self":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/comments/53559803"},"html":{"href":"https://github.com/bbcmicrobit/micropython/pull/212#discussion_r53559803"},"pull_request":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212"}}},"pull_request":{"url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212","id":59304444,"html_url":"https://github.com/bbcmicrobit/micropython/pull/212","diff_url":"https://github.com/bbcmicrobit/micropython/pull/212.diff","patch_url":"https://github.com/bbcmicrobit/micropython/pull/212.patch","issue_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/212","number":212,"state":"open","locked":false,"title":"Lessons/Tutorials","user":{"login":"ntoll","id":37602,"avatar_url":"https://avatars.githubusercontent.com/u/37602?v=3","gravatar_id":"","url":"https://api.github.com/users/ntoll","html_url":"https://github.com/ntoll","followers_url":"https://api.github.com/users/ntoll/followers","following_url":"https://api.github.com/users/ntoll/following{/other_user}","gists_url":"https://api.github.com/users/ntoll/gists{/gist_id}","starred_url":"https://api.github.com/users/ntoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntoll/subscriptions","organizations_url":"https://api.github.com/users/ntoll/orgs","repos_url":"https://api.github.com/users/ntoll/repos","events_url":"https://api.github.com/users/ntoll/events{/privacy}","received_events_url":"https://api.github.com/users/ntoll/received_events","type":"User","site_admin":false},"body":"I've created this PR so the work on tutorials / lessons gets some visibility in the wider project. All comments, constructive critique and ideas are most welcome.\r\n\r\nFor modifications let's correct the obvious mistakes in this PR, merge it and then update with later PRs.","created_at":"2016-02-14T20:09:41Z","updated_at":"2016-02-21T00:46:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f294546fedc664dc604d9883d07d8b9439390a3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212/commits","review_comments_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212/comments","review_comment_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/212/comments","statuses_url":"https://api.github.com/repos/bbcmicrobit/micropython/statuses/74b4e1616354ea3ac733330e94f2bc6abe6d09a7","head":{"label":"bbcmicrobit:tutorials","ref":"tutorials","sha":"74b4e1616354ea3ac733330e94f2bc6abe6d09a7","user":{"login":"bbcmicrobit","id":15104236,"avatar_url":"https://avatars.githubusercontent.com/u/15104236?v=3","gravatar_id":"","url":"https://api.github.com/users/bbcmicrobit","html_url":"https://github.com/bbcmicrobit","followers_url":"https://api.github.com/users/bbcmicrobit/followers","following_url":"https://api.github.com/users/bbcmicrobit/following{/other_user}","gists_url":"https://api.github.com/users/bbcmicrobit/gists{/gist_id}","starred_url":"https://api.github.com/users/bbcmicrobit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbcmicrobit/subscriptions","organizations_url":"https://api.github.com/users/bbcmicrobit/orgs","repos_url":"https://api.github.com/users/bbcmicrobit/repos","events_url":"https://api.github.com/users/bbcmicrobit/events{/privacy}","received_events_url":"https://api.github.com/users/bbcmicrobit/received_events","type":"Organization","site_admin":false},"repo":{"id":40358251,"name":"micropython","full_name":"bbcmicrobit/micropython","owner":{"login":"bbcmicrobit","id":15104236,"avatar_url":"https://avatars.githubusercontent.com/u/15104236?v=3","gravatar_id":"","url":"https://api.github.com/users/bbcmicrobit","html_url":"https://github.com/bbcmicrobit","followers_url":"https://api.github.com/users/bbcmicrobit/followers","following_url":"https://api.github.com/users/bbcmicrobit/following{/other_user}","gists_url":"https://api.github.com/users/bbcmicrobit/gists{/gist_id}","starred_url":"https://api.github.com/users/bbcmicrobit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbcmicrobit/subscriptions","organizations_url":"https://api.github.com/users/bbcmicrobit/orgs","repos_url":"https://api.github.com/users/bbcmicrobit/repos","events_url":"https://api.github.com/users/bbcmicrobit/events{/privacy}","received_events_url":"https://api.github.com/users/bbcmicrobit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bbcmicrobit/micropython","description":"Port of MicroPython for the BBC micro:bit","fork":false,"url":"https://api.github.com/repos/bbcmicrobit/micropython","forks_url":"https://api.github.com/repos/bbcmicrobit/micropython/forks","keys_url":"https://api.github.com/repos/bbcmicrobit/micropython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbcmicrobit/micropython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbcmicrobit/micropython/teams","hooks_url":"https://api.github.com/repos/bbcmicrobit/micropython/hooks","issue_events_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/events{/number}","events_url":"https://api.github.com/repos/bbcmicrobit/micropython/events","assignees_url":"https://api.github.com/repos/bbcmicrobit/micropython/assignees{/user}","branches_url":"https://api.github.com/repos/bbcmicrobit/micropython/branches{/branch}","tags_url":"https://api.github.com/repos/bbcmicrobit/micropython/tags","blobs_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbcmicrobit/micropython/statuses/{sha}","languages_url":"https://api.github.com/repos/bbcmicrobit/micropython/languages","stargazers_url":"https://api.github.com/repos/bbcmicrobit/micropython/stargazers","contributors_url":"https://api.github.com/repos/bbcmicrobit/micropython/contributors","subscribers_url":"https://api.github.com/repos/bbcmicrobit/micropython/subscribers","subscription_url":"https://api.github.com/repos/bbcmicrobit/micropython/subscription","commits_url":"https://api.github.com/repos/bbcmicrobit/micropython/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbcmicrobit/micropython/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbcmicrobit/micropython/contents/{+path}","compare_url":"https://api.github.com/repos/bbcmicrobit/micropython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbcmicrobit/micropython/merges","archive_url":"https://api.github.com/repos/bbcmicrobit/micropython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbcmicrobit/micropython/downloads","issues_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues{/number}","pulls_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls{/number}","milestones_url":"https://api.github.com/repos/bbcmicrobit/micropython/milestones{/number}","notifications_url":"https://api.github.com/repos/bbcmicrobit/micropython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbcmicrobit/micropython/labels{/name}","releases_url":"https://api.github.com/repos/bbcmicrobit/micropython/releases{/id}","deployments_url":"https://api.github.com/repos/bbcmicrobit/micropython/deployments","created_at":"2015-08-07T11:58:53Z","updated_at":"2016-02-16T02:58:26Z","pushed_at":"2016-02-21T00:16:14Z","git_url":"git://github.com/bbcmicrobit/micropython.git","ssh_url":"git@github.com:bbcmicrobit/micropython.git","clone_url":"https://github.com/bbcmicrobit/micropython.git","svn_url":"https://github.com/bbcmicrobit/micropython","homepage":"","size":20537,"stargazers_count":121,"watchers_count":121,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":41,"forks":35,"open_issues":41,"watchers":121,"default_branch":"master"}},"base":{"label":"bbcmicrobit:master","ref":"master","sha":"4c3e38223557ba7c1e627633ef47b7ae9950895f","user":{"login":"bbcmicrobit","id":15104236,"avatar_url":"https://avatars.githubusercontent.com/u/15104236?v=3","gravatar_id":"","url":"https://api.github.com/users/bbcmicrobit","html_url":"https://github.com/bbcmicrobit","followers_url":"https://api.github.com/users/bbcmicrobit/followers","following_url":"https://api.github.com/users/bbcmicrobit/following{/other_user}","gists_url":"https://api.github.com/users/bbcmicrobit/gists{/gist_id}","starred_url":"https://api.github.com/users/bbcmicrobit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbcmicrobit/subscriptions","organizations_url":"https://api.github.com/users/bbcmicrobit/orgs","repos_url":"https://api.github.com/users/bbcmicrobit/repos","events_url":"https://api.github.com/users/bbcmicrobit/events{/privacy}","received_events_url":"https://api.github.com/users/bbcmicrobit/received_events","type":"Organization","site_admin":false},"repo":{"id":40358251,"name":"micropython","full_name":"bbcmicrobit/micropython","owner":{"login":"bbcmicrobit","id":15104236,"avatar_url":"https://avatars.githubusercontent.com/u/15104236?v=3","gravatar_id":"","url":"https://api.github.com/users/bbcmicrobit","html_url":"https://github.com/bbcmicrobit","followers_url":"https://api.github.com/users/bbcmicrobit/followers","following_url":"https://api.github.com/users/bbcmicrobit/following{/other_user}","gists_url":"https://api.github.com/users/bbcmicrobit/gists{/gist_id}","starred_url":"https://api.github.com/users/bbcmicrobit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbcmicrobit/subscriptions","organizations_url":"https://api.github.com/users/bbcmicrobit/orgs","repos_url":"https://api.github.com/users/bbcmicrobit/repos","events_url":"https://api.github.com/users/bbcmicrobit/events{/privacy}","received_events_url":"https://api.github.com/users/bbcmicrobit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bbcmicrobit/micropython","description":"Port of MicroPython for the BBC micro:bit","fork":false,"url":"https://api.github.com/repos/bbcmicrobit/micropython","forks_url":"https://api.github.com/repos/bbcmicrobit/micropython/forks","keys_url":"https://api.github.com/repos/bbcmicrobit/micropython/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbcmicrobit/micropython/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbcmicrobit/micropython/teams","hooks_url":"https://api.github.com/repos/bbcmicrobit/micropython/hooks","issue_events_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/events{/number}","events_url":"https://api.github.com/repos/bbcmicrobit/micropython/events","assignees_url":"https://api.github.com/repos/bbcmicrobit/micropython/assignees{/user}","branches_url":"https://api.github.com/repos/bbcmicrobit/micropython/branches{/branch}","tags_url":"https://api.github.com/repos/bbcmicrobit/micropython/tags","blobs_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbcmicrobit/micropython/statuses/{sha}","languages_url":"https://api.github.com/repos/bbcmicrobit/micropython/languages","stargazers_url":"https://api.github.com/repos/bbcmicrobit/micropython/stargazers","contributors_url":"https://api.github.com/repos/bbcmicrobit/micropython/contributors","subscribers_url":"https://api.github.com/repos/bbcmicrobit/micropython/subscribers","subscription_url":"https://api.github.com/repos/bbcmicrobit/micropython/subscription","commits_url":"https://api.github.com/repos/bbcmicrobit/micropython/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbcmicrobit/micropython/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbcmicrobit/micropython/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbcmicrobit/micropython/contents/{+path}","compare_url":"https://api.github.com/repos/bbcmicrobit/micropython/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbcmicrobit/micropython/merges","archive_url":"https://api.github.com/repos/bbcmicrobit/micropython/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbcmicrobit/micropython/downloads","issues_url":"https://api.github.com/repos/bbcmicrobit/micropython/issues{/number}","pulls_url":"https://api.github.com/repos/bbcmicrobit/micropython/pulls{/number}","milestones_url":"https://api.github.com/repos/bbcmicrobit/micropython/milestones{/number}","notifications_url":"https://api.github.com/repos/bbcmicrobit/micropython/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbcmicrobit/micropython/labels{/name}","releases_url":"https://api.github.com/repos/bbcmicrobit/micropython/releases{/id}","deployments_url":"https://api.github.com/repos/bbcmicrobit/micropython/deployments","created_at":"2015-08-07T11:58:53Z","updated_at":"2016-02-16T02:58:26Z","pushed_at":"2016-02-21T00:16:14Z","git_url":"git://github.com/bbcmicrobit/micropython.git","ssh_url":"git@github.com:bbcmicrobit/micropython.git","clone_url":"https://github.com/bbcmicrobit/micropython.git","svn_url":"https://github.com/bbcmicrobit/micropython","homepage":"","size":20537,"stargazers_count":121,"watchers_count":121,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":41,"forks":35,"open_issues":41,"watchers":121,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212"},"html":{"href":"https://github.com/bbcmicrobit/micropython/pull/212"},"issue":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/issues/212"},"comments":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/issues/212/comments"},"review_comments":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212/comments"},"review_comment":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/pulls/212/commits"},"statuses":{"href":"https://api.github.com/repos/bbcmicrobit/micropython/statuses/74b4e1616354ea3ac733330e94f2bc6abe6d09a7"}}}}