Skip to content

About

A small example demonstrating WebSocket communication on the Arduino using express, johnny-five, and socket.io

Resources

Stars

0 stars

Watchers

3 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

README

This is a small, sample project demonstrating how to use:

  • johnny-five (a Node library which lets you talk to many microcontoller platforms—including the Arduino and Tessel—via JavaScript)
  • express (another Node library which lets you write a simple web server with JavaScript)
  • and socket.io (a Node library which lets us talk over WebSockets—a protocol for easy, two-way communication between a browser and server—via JavaScript

To run this project, we need to do two things:

  1. Teach the Arduino how to receive communications from our computer for the johnny-five library.
  2. And install the required libraries and run the code for this sample project.

To do (1):

  1. Download and install the Arduino IDE (integrated development environment—kind of like a Sublime Text which can talk to the Arduino)
  2. Open the Arduino IDE, and open the StandardFermata example by going to File > Examples > Fermata > StandardFermata
  3. Upload the StandardFermata sketch by selecting Sketch > Upload

To do (2):

  1. Clone this repository via GitHub Desktop or from the command line (git clone git@github.com:dgmd/arduino-websocket-example.git).
  2. Open the cloned repository in your terminal.
  3. Within the repository, run npm install in your terminal. This uses npm—Node's package manager—to install the libraries required for this project (express and johnny-five) by looking within the package.json file.
  4. Connect your Arduino to your computer via USB.
  5. In your terminal (which should still be within the cloned repository), run node server.js
  6. You should see Server's up at http://localhost:3000!; when you do, go to http://localhost:3000 and you should see "Hello from server.js!"
  7. Now you can explore the other routes and behavior detailed in server.js

About

A small example demonstrating WebSocket communication on the Arduino using express, johnny-five, and socket.io

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages