Skip to content

Commit

Permalink
Merge pull request tessel#35 from tessel/kb-fixes
Browse files Browse the repository at this point in the history
Cleanup to the start experience
  • Loading branch information
Frijol committed Sep 13, 2015
2 parents 598b289 + e987874 commit ae25332
Show file tree
Hide file tree
Showing 16 changed files with 613 additions and 272 deletions.
26 changes: 15 additions & 11 deletions blinky.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@

Blinking some lights is the "Hello World" of hardware. Let's make those LEDs built into Tessel 2 dance for us.

In your command line, make a folder for your Tessel code, then initialize a Tessel project in that folder.
In your command line, make a folder for your Tessel code, then initialize a Tessel project in that folder by running each of the following commands in the terminal:

{% highlight sh %}
mkdir tessel-code
cd tessel-code
t2 init
{% endhighlight %}
`mkdir tessel-code`

Great! Now you're set up to run code on Tessel. Your `tessel-code` folder now contains a `package.json` with some metadata Node uses for your project, and a file called `index.js`.
`cd tessel-code`

`index.js` contains the code to make the blue and green LEDs blink. Let's take a look:
`t2 init`

</div>
</div>

<div class="row">
<div class="large-12 columns">

Great! Now you're set up to run code on Tessel. Your "tessel-code" folder now contains a "package.json" with some metadata Node uses for your project, and a file called "index.js".

"index.js" contains the code to make the blue and green LEDs blink. Let's take a look:

{% highlight javascript %}
// Import the interface to Tessel hardware
Expand All @@ -43,9 +49,7 @@ console.log("I'm blinking! (Press CTRL + C to stop)");

In your command line, enter

{% highlight sh %}
t2 run blinky.js
{% endhighlight %}
`t2 run blinky.js`

to run your code in Tessel's RAM.

Expand Down
209 changes: 5 additions & 204 deletions cmd.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,208 +2,9 @@
layout: default
---

<h1>Command Line Basics</h1>
<p>Using Tessel is just like web development. But if
you're not familiar with web development, you might want
to take a minute or two to get comfortable with some key
tools of the trade: the command line (the "terminal",
where you execute commands) and the text editor, where
you will work on and save your programs.</p>
<p>Select the operating system you are working on.</p>
<dl id="install-tabs" data-tab="" class=
"tabs contained three-up">
<dd class="active">
<a id="osx-tab" href="cmd.html#tab-osx" data-toggle=
"tab">OSX</a>
</dd>
<dd>
<a id="linux-tab" href="cmd.html#tab-linux"
data-toggle="tab">Linux</a>
</dd>
<dd>
<a id="pc-tab" href="cmd.html#tab-pc" data-toggle=
"tab">Windows</a>
</dd>
</dl>
<div id="install-content" class="tabs-content">
<div id="tab-osx" class="content active">
<p>Open up the application on your computer called
“Terminal” by pressing ⌘ + SPACE and typing
“Terminal”.</p>
<p>Its dock icon looks like <img src=
"https://s3.amazonaws.com/technicalmachine-assets/fre+assets/mac-term-icon.png">
, and the terminal will look something like
<img src="https://s3.amazonaws.com/technicalmachine-assets/fre+assets/mac-term.png">
</p>
<p>You can use the terminal to write commands to your
computer (this is the “command line”). Let’s try it
out!</p>
<p>In your terminal,
type</p><kbd><code>ls</code></kbd>
<p>and hit enter.</p>
<p>The <code>ls</code> command, short for “list”,
tells your computer to list all of the file names for
the folder you’re in. Your list of files probably
includes “Desktop” and “Documents”, among others.
Let’s try another command: type</p><kbd><code>cd
Documents</code></kbd>
<p>and hit enter.</p>
<p>You are now in the Documents folder;
<code>cd</code> means “change directory”. If you try
<code>ls</code> again, you should see the contents of
your Documents folder listed out. If you want to
compare, open up Finder and look in Documents to see
the same files.</p>
<p>Let’s get back to the folder we were in
before:</p><kbd><code>cd ..</code></kbd>
<p>You changed directory
again!</p><kbd><code>ls</code></kbd>
<p>to see what we have here. You’re back where you
started! The <code>..</code> after <code>cd</code>
tells it to go up one folder in the directory.</p>
<p>Ok, now you're a cool hacker who can use the
terminal (or "console") to write in the command line.
(If you want to learn more commands, there are a
whole bunch of them <a href="http://ss64.com/bash/"
target="1">here</a>. I recommend <code>pwd</code>,
<code>open</code>, <code>mkdir</code>,
<code>touch</code>, <code>mv</code>, and
<code>cp</code>.)</p>
</div>
<div id="tab-linux" class="content">
<p>Open up the application on your computer called
“Terminal” by tapping the SUPER key (Windows or Apple
key, depending on your hardware) and typing
“Terminal”.</p>
<p>Its icon looks like <img src=
"https://s3.amazonaws.com/technicalmachine-assets/fre+assets/mac-term-icon.png">
, and the terminal will look something like
<img src="https://s3.amazonaws.com/technicalmachine-assets/fre+assets/mac-term.png">
</p>
<p>You can use the terminal to write commands to your
computer (this is the “command line”). Let’s try it
out!</p>
<p>In your terminal,
type</p><kbd><code>ls</code></kbd>
<p>and hit enter.</p>
<p>The <code>ls</code> command, short for “list”,
tells your computer to list all of the file names for
the folder you’re in. Your list of files probably
includes “Desktop” and “Documents”, among others.
Let’s try another command: type</p><kbd><code>cd
Documents</code></kbd>
<p>and hit enter.</p>
<p>You are now in the Documents folder;
<code>cd</code> means “change directory”. If you try
<code>ls</code> again, you should see the contents of
your Documents folder listed out. If you want to
compare, open up Finder and look in Documents to see
the same files.</p>
<p>Let’s get back to the folder we were in
before:</p><kbd><code>cd ..</code></kbd>
<p>You changed directory
again!</p><kbd><code>ls</code></kbd>
<p>to see what we have here. You’re back where you
started! The <code>..</code> after <code>cd</code>
tells it to go up one folder in the directory.</p>
<p>Ok, now you're a cool hacker who can use the
terminal (or "console") to write in the command line.
(If you want to learn more commands, there are a
whole bunch of them <a href="http://ss64.com/bash/"
target="1">here</a>. I recommend <code>pwd</code>,
<code>open</code>, <code>mkdir</code>,
<code>touch</code>, <code>mv</code>, and
<code>cp</code>.)</p>
</div>
<div id="tab-pc" class="content">
<p>Open up the application on your computer called
“Command Prompt”.</p>
<p>If you’re not on Windows 8, go to the start menu
and type “Command Prompt”.</p>
<p>If you are on Windows 8+, swipe right to find
“Windows System”, within which you can find “Command
Prompt”.</p>
<p>Its icon looks like <img src=
"https://s3.amazonaws.com/technicalmachine-assets/fre+assets/win-term-icon.png">
, and the application (the terminal) will look
something like <img src=
"https://s3.amazonaws.com/technicalmachine-assets/fre+assets/win-term.png">
</p>
<p>You can use the terminal to write commands to your
computer (this is the “command line”). Let’s try it
out!</p>
<p>In your terminal,
type</p><kbd><code>dir</code></kbd>
<p>and hit enter.</p>
<p>The <code>dir</code> command, short for
“directory”, tells your computer to list all of the
file names for the folder you’re in. Your list of
files probably includes “Desktop” and “Documents”,
among others. Let’s try another command:</p>
<p>Now type</p><kbd><code>cd Documents</code></kbd>
<p>into your command line and press enter.</p>
<p>You are now in the Documents folder;
<code>cd</code> means “change directory”. If you try
<code>dir</code> again, you should see the contents
of your Documents folder listed out. If you want to
compare, open up My Comuter and look in Documents to
see the same files.</p>
<p>Let’s get back to the folder we were in
before:</p><kbd><code>cd ..</code></kbd>
<p>You changed directory
again!</p><kbd><code>dir</code></kbd>
<p>to see what we have here. You’re back where you
started! The <code>..</code> after <code>cd</code>
tells it to go up one folder in the directory.</p>
<p>Now you’re a cool hacker who can use the terminal
to write in the command line. (If you want to learn
more commands, there are a whole bunch of them
<a href="http://ss64.com/nt/" target=
"1">here</a>.)</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns fre-container">
<h3 id="text-editor">Text Editors</h3>
<p>You will also need a text editor to save your
JavaScript files. This means a plaintext editor, not a
Word document.</p>
<p>Here are some good options:</p>
<ul>
<li>
<a href="http://www.sublimetext.com/">Sublime
Text</a>
</li>
<li>
<a href="https://atom.io/">Atom</a>
</li>
<li>
<a href="http://notepad-plus-plus.org/">Notepad++</a>
</li>
</ul>
<script src="javascripts/custom/install.js"></script>

<p>Typically, directions that belong in the command line
are one line, whereas longer scripts, such as anything in
JavaScript, should be typed into the text editor and
saved, then run through the command line.</p>

<p>In the context of this tutorial, things that should be
run in the command line look</p><kbd><code>like
this</code></kbd>

<p>And scripts that should be saved in the text editor
will look</p>

<pre class="prettyprint">
<code>like this</code>
</pre>

<div class="greyBar"></div>

<div class="row">
<div class="large-12 columns right">
<a href="index.html" class="bottomButton right button">Next: Install</a>
</div>
</div>
{% capture include_install %}
{% include_relative cmd.md %}
{% endcapture %}
{{ include_install | markdownify | replace: '<p>|','<dd>' | replace: '|</p>','</dd>' | replace: '||','</dd><dd>' }}
Loading

0 comments on commit ae25332

Please sign in to comment.