<commit_before>extends layout

block content
  .row
    .large-12.columns.fre-container
      .row
        .large-12.columns
          h1 Connect Tessel to Wifi
      br
      .row
        .large-12.columns
          p Tessel can only connect to 2.4GHz networks.
          p <b>To connect to a new network,</b> enter in your command line (without brackets)
          code
            cli tessel wifi -n [network name] -p [password] -s [security type*]
          i <code>*</code>The security type flag is optional; default is wpa2.<br/><br/>
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
      .row
        .large-6.columns
          p Tessel will blink the yellow status light while connecting, and will leave the yellow light on if it connects. Tessel saves network credentials and tries to reconnect automatically on startup.
          p To check whether you're connected, run
          code
            cli tessel wifi -l
          p This lists available wifi networks and will also show your connection status.
        .large-6.columns
          img(src="#{s3url}wifi.JPG").constrain
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
          p Here is an example of requesting a website over Tessel's Wifi connection:
          p Save the following code in a file called <code>wifi.js</code>:
          pre.prettyprint#exampleCode
            code.
              var http = require('http');

              var statusCode = 200;
              var count = 1;

              setImmediate(function start () {
                console.log('http request #' + (count++))
                http.get("http://httpstat.us/" + statusCode, function (res) {
                  console.log('# statusCode', res.statusCode)

                  var bufs = [];
                  res.on('data', function (data) {
                    bufs.push(new Buffer(data));
                    console.log('# received', new Buffer(data).toString());
                  })
                  res.on('close', function () {
                    console.log('done.');
                    setImmediate(start);
                  })
                }).on('error', function (e) {
                  console.log('not ok -', e.message, 'error event')
                  setImmediate(start);
                });
              });

          p Run the code on your Tessel by typing this in the terminal:
          p <code><cli>tessel run wifi.js</cli></code>
          p Watch Tessel ping the website in your console!
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
      .row
        .large-12.columns
          p <b>If you run into errors:</b> First, check to make sure the yellow status light is on. If it is not, you are not connected to Wifi. Try power cycling your Tessel and then run the <code>tessel wifi</code> command again.
          p If you're still having trouble, please log your error on the <a href="http://forums.tessel.io/category/wifi">Wifi forums</a>.

block bottom_nav<commit_msg>Changed the response event fron close to end in the wifi tutorial. This tripped me up a little bit. However, with end in place everything works accordingly.<commit_after>extends layout

block content
  .row
    .large-12.columns.fre-container
      .row
        .large-12.columns
          h1 Connect Tessel to Wifi
      br
      .row
        .large-12.columns
          p Tessel can only connect to 2.4GHz networks.
          p <b>To connect to a new network,</b> enter in your command line (without brackets)
          code
            cli tessel wifi -n [network name] -p [password] -s [security type*]
          i <code>*</code>The security type flag is optional; default is wpa2.<br/><br/>
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
      .row
        .large-6.columns
          p Tessel will blink the yellow status light while connecting, and will leave the yellow light on if it connects. Tessel saves network credentials and tries to reconnect automatically on startup.
          p To check whether you're connected, run
          code
            cli tessel wifi -l
          p This lists available wifi networks and will also show your connection status.
        .large-6.columns
          img(src="#{s3url}wifi.JPG").constrain
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
          p Here is an example of requesting a website over Tessel's Wifi connection:
          p Save the following code in a file called <code>wifi.js</code>:
          pre.prettyprint#exampleCode
            code.
              var http = require('http');

              var statusCode = 200;
              var count = 1;

              setImmediate(function start () {
                console.log('http request #' + (count++))
                http.get("http://httpstat.us/" + statusCode, function (res) {
                  console.log('# statusCode', res.statusCode)

                  var bufs = [];
                  res.on('data', function (data) {
                    bufs.push(new Buffer(data));
                    console.log('# received', new Buffer(data).toString());
                  })
                  res.on('end', function () {
                    console.log('done.');
                    setImmediate(start);
                  })
                }).on('error', function (e) {
                  console.log('not ok -', e.message, 'error event')
                  setImmediate(start);
                });
              });

          p Run the code on your Tessel by typing this in the terminal:
          p <code><cli>tessel run wifi.js</cli></code>
          p Watch Tessel ping the website in your console!
      .row
        .large-12.columns
          .greyBar(style="height:2px;")
      .row
        .large-12.columns
          p <b>If you run into errors:</b> First, check to make sure the yellow status light is on. If it is not, you are not connected to Wifi. Try power cycling your Tessel and then run the <code>tessel wifi</code> command again.
          p If you're still having trouble, please log your error on the <a href="http://forums.tessel.io/category/wifi">Wifi forums</a>.

block bottom_nav
{'fraction_non_alphanumeric': 0.09834484975092399, 'fraction_numerical': 0.008998875140607425, 'mean_word_length': 1.7274320771253286, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7516076', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1611, 'n_words': 593}