Permalink
Browse files

Prepping for module testing

  • Loading branch information...
1 parent 8dbc580 commit 79d0bc22df73957d26b1aa9c09f1be03b067c692 @sarahgp committed Jul 31, 2015
View
@@ -1,2 +1,3 @@
.DS_Store
-node_modules
+node_modules
+**/npm-debug.log
View
@@ -30,7 +30,8 @@
"commander": "^2.8.1",
"firmata": "^0.5.4",
"nanotimer": "^0.3.10",
- "serialport": "^1.7.4"
+ "serialport": "^1.7.4",
+ "socket.io": "^1.3.6"
},
"author": "Sarah Groff-Palermo",
"license": "LGPL"
@@ -1,2 +1,58 @@
-# This is the README for p5bots-server files
-It will include a link to the main README.
+# p5bots-server
+
+These are the files necessary for the server end of the p5bots setup.
+
+_Note: This is still version 0.0.0, so there are a lot of todos left. Anything can happen._
+
+## Setup
+
+### Arduino
+1. Download Arduino IDE
+2. Upload Examples > Firmata > StandardFirmata to your board
+3. Write down the port your board is using; you may need it later.
+
+### Javascript
+1. Install node & npm if you haven't already; be sure you have node 0.12.x+ and npm 2.0.x+
+2. Install firmata on your computer: `npm install -g firmata`
+3. `npm install` in the `p5bots-server` directory
+
+## Run Examples
+
+To test your setup, you can run any of the examples in `examples/quicktest.js`.
+
+Currently, the RGB LED test is uncommented. To run this, set up the breadboard as shown below, then run:
+
+```js
+npm run examples-go
+```
+
+Open your browser to `localhost:8000` and you should see a circle whose color is also displayed on your RGB Led.
+
+:rotating_light::rotating_light::rotating_light:
+If you get an error telling you the board cannot be found, or something like:
+
+```js
+Error: Error: Cannot open /dev/cu.usbmodem1421
+```
+
+you may have to adjust [the board declaration in `quicktest.js`](https://github.com/sarahgp/p5bots/blob/master/src/p5bots-server/example/quicktest.js#L48).
+
+Either use the port you noted down in setup, assuming you haven't moved the board, or check out the console, where we are listing the ports via the serial command. The one that looks like `/dev/cu.*` is likely the one you need.
+
+## Command Line Options
+Although the `examples-go` script is setup to start the examples folder, you may want to move things around.
+
+`./app.js` can be run with the following options:
+
+```
+-d, --dir <d> Set base directory for server
+-f, --file <f> Set file to use for the index page
+-p, --ufilepath <p> Path to file containing user-defined server-side listeners.
+-n, --ufilename <n> Path, inluding file name, to user-defined server-side listeners.
+```
+
+You can also find these by running
+
+```js
+node ./app.js -h
+```
@@ -16,14 +16,14 @@ var directory, index, program;
program
.description('Let your board talk to your sketch')
.option('-d, --dir <d>', 'Set base directory for server')
- .option('-f, --file <f>', 'Set file to use')
+ .option('-f, --file <f>', 'Set file to use for index page')
.option('-p, --ufilepath <p>', 'Path to file containing user-defined server-side listeners.')
.option('-n, --ufilename <n>', 'Path, inluding file name, to user-defined server-side listeners.')
.parse(process.argv);
exports.program = program;
exports.directory = directory = program.dir || __dirname;
-exports.index = index = program.file || (__dirname + '/index.html');
+exports.index = index = program.file || (directory + '/index.html');
// Setup server, sockets, and events
@@ -6,9 +6,9 @@
</head>
<body>
<script src="https://cdn.socket.io/socket.io-1.3.5.js"></script>
- <script src="/lib/p5.js"></script>
- <script src="/lib/p5.dom.js"></script>
- <script src="/lib/p5bots.js"></script>
- <script src="/src/server/quicktest.js"></script>
+ <script src="/p5_scripts/p5.min.js"></script>
+ <script src="/p5_scripts/p5.dom.js"></script>
+ <script src="/p5_scripts/p5bots.js"></script>
+ <script src="/quicktest.js"></script>
</body>
</html>
@@ -37,7 +37,12 @@
/////////////////////////////
console.log('quicktest');
-
+console.log('serial list:');
+p5.serial().list(function(data) {
+ data.ports.forEach(function(port) {
+ console.log(port.comName);
+ });
+});
//////////////////////
@@ -14,14 +14,16 @@
"main": "src/app.js",
"scripts": {
"start": "node ./app.js",
- "sensors-up": "node ./app.js"
+ "sensors-up": "node ./app.js",
+ "examples-go": "node ./app.js -d 'example'"
},
"dependencies": {
"commander": "^2.8.1",
"express": "^4.13.1",
"firmata": "^0.5.4",
"nanotimer": "^0.3.10",
- "serialport": "^1.7.4"
+ "serialport": "^1.7.4",
+ "socket.io": "^1.3.6"
},
"license": "LGPL-2.1",
"bugs": {

0 comments on commit 79d0bc2

Please sign in to comment.