Skip to content

Latest commit

 

History

History
194 lines (159 loc) · 5.63 KB

Tessel2NodeBots.md

File metadata and controls

194 lines (159 loc) · 5.63 KB

nodeBots with Tessel 2

nodeBots

alt text

NodeBots Day

github.com/nodebots/nodebotsday

at CAA Saturday, August 6th

Internationally Saturday, July 30th

--

Tessel 2

alt text

  • A microcontroller that runs javascript
  • Node built-in
  • USB, Ethernet, WiFi
  • Two General Purpose I/O Ports (GPIO)
  • Lots of plug-in modules -- * accelerometer, climate, ambient, IR, servo, RFID, etc.
  • t2 Command-line Interface
  • https://tessel.io/

t2 Command Line Interface

We have already installed node.js and used npm to install the t2 CLI for you. If you are at home you need to go to https://nodejs.org/en/ and install node. Then, at a command prompt, npm install t2-cli -g to install the t2 command line tool globally on your computer.

Get familiar with the t2 command:

  • Open a command prompt Start+Run cmd
  • Change directory to dev directory
cd \dev
  • Make a tessel directory
mkdir tessel
  • Change to the tessel directory
cd tessel
  • Plug in your tessel via micro USB cable (wait 30 seconds for it to boot)
  • Search for tessels
t2 list
  • Name your tessel
t2 rename *whatever*
  • Search for your tessel
t2 list
  • See what version of node your tessel has
t2 version –n *whatever*
  • Connect your tessel to WiFi
t2 wifi –n caa-guest
  • Setup secure communications
t2 provision
  • See all the t2 commands
t2

Usage: t2

  • command
  • install-drivers | Install drivers
  • crash-reporter | Configure the Crash Reporter
  • provision | Authorize your computer to control the USB|connected Tessel
  • restart | Restart a previously deployed script in RAM or Flash memory (does not rebundle)
  • run | Deploy a script to Tessel and run it with Node
  • push | Pushes the file/dir to Flash memory to be run anytime the Tessel is powered
  • erase | Erases files pushed to Flash using the tessel push command
  • list | Lists all connected Tessels and their authorization status
  • init | Initialize repository for your Tessel project
  • wifi | Configure the wireless connection
  • key | Manage ssh keys for connecting to a Tessel
  • rename | Change the name of a Tessel to something new
  • update | Update the Tessel firmware and openWRT image
  • version | Display Tessel's current firmware version
  • ap | Configure the Tessel as an access point
  • root | Gain SSH root access to one of your authorized tessels

--

Projects

Blinky

alt text

  • Make a directory for your project
mkdir blinky
  • Change to your project folder
cd blinky
  • Initialize a Tessel project
t2 init
  • See what was created
dir
  • Edit your project. Open the sublime editor (Start+Run sublime), open the project folder c:\dev\tessel\blinky
  • Look at the index.js file (click index.js in file list on the left in sublime)
// Import the interface to Tessel hardware
var tessel = require('tessel');

// Turn one of the LEDs on to start.
tessel.led[2].on();

// Blink!
setInterval(function () {
  tessel.led[2].toggle();
  tessel.led[3].toggle();
}, 100); // every 100 millseconds (1/10th of a second)

console.log("I'm blinking! (Press CTRL + C to stop)");
  • Run your project on your tessel
t2 run index.js

Projects

  • Open a git bash window
  • Change directory to the tessel dev directory
cd \dev\tessel
  • Download the materials
git clone [email protected]:gdibble/caa-nodeTraining.git
  • Change directory to open of the project folders
cd caa-nodeTraining/node-audio

--

Resources

--

Made with ♥ by CAA