Skip to content

Commit

Permalink
Merge pull request #1 from sarahgp/master
Browse files Browse the repository at this point in the history
Fast Forward
  • Loading branch information
limzykenneth committed Feb 9, 2016
2 parents 6ee61f9 + 87bf763 commit 8a77fe5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions examples/HelloWorld.md
Expand Up @@ -164,11 +164,11 @@ You can test that your setup is working by plugging the Arduino into the compute
### Start the Server
Now we need to open the gates and let the two talk.

1. Return to the Terminal. Be sure you are in `helloWorld`.
2. Type `bots-go -f`, then drag the `index.html` file into the terminal window. You should end up with something like this:
1. Return to the Terminal.
2. Type `bots-go -d`, then drag the `helloWorld` folder into the terminal window. You should end up with something like this:

```bash
bots-go -f /Users/computer/sites/p5bots/helloWord/index.html
bots-go -d /Users/computer/sites/p5bots/helloWord/
```

Hit enter and you should something like this:
Expand All @@ -180,4 +180,4 @@ server starting
### Hello, World!
Yay! Everything is running. Open a web browser to `localhost:8000`. Hit the left arrow to turn the LED on; right to turn it off. Hit up and get it blinking.

Now open the console, probably by hitting: `command+option+I`. There should be note for you in the log: the LED is saying hello!
Now open the console, probably by hitting: `command+option+I`. There should be note for you in the log: the LED is saying hello!
7 changes: 3 additions & 4 deletions lib/p5bots.js
@@ -1,4 +1,4 @@
/*! p5bots.js v0.0.2 September 13, 2015 */
/*! p5bots.js v0.0.2 October 26, 2015 */
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.p5js = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* @module Basic constructors
Expand Down Expand Up @@ -665,15 +665,15 @@ var serial = function() {
serialObj.write = function(arg, cb) {
socket.emit('serial write', { arg: arg });
socket.on('serial write return', function(data){
cb(data);
cb && cb(data);
});
};

serialObj.list = function(cb) {
socket.emit('serial list');
socket.on('serial list return', function(data) {
console.log(data);
cb && cb(data);
cb && cb(data.data); // unwrap the data so the client doesn't need to
});
};

Expand Down Expand Up @@ -774,7 +774,6 @@ var utils = {
var mode = mode || pin.mode; // jshint ignore:line

function setVal(data) {
console.log('return val' + pin.pin);
// Callbacks set in socketGen for generic read
// & in special constructors for special
this.readcb && this.readcb(data.val);
Expand Down
2 changes: 1 addition & 1 deletion lib/p5bots.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/client/lib/serial.js
Expand Up @@ -40,15 +40,15 @@ var serial = function() {
serialObj.write = function(arg, cb) {
socket.emit('serial write', { arg: arg });
socket.on('serial write return', function(data){
cb(data);
cb && cb(data);
});
};

serialObj.list = function(cb) {
socket.emit('serial list');
socket.on('serial list return', function(data) {
console.log(data);
cb && cb(data);
cb && cb(data.data); // unwrap the data so the client doesn't need to
});
};

Expand Down
6 changes: 3 additions & 3 deletions src/p5bots-server/example/p5_scripts/p5bots.js
Expand Up @@ -481,7 +481,7 @@ var serial = function() {
path: path,
config: config
});
}
};

serialObj.read = function(cb) {
socket.emit('serial read');
Expand All @@ -493,7 +493,7 @@ var serial = function() {
serialObj.write = function(arg, cb) {
socket.emit('serial write', { arg: arg });
socket.on('serial write return', function(data){
cb(data);
cb && cb(data);
});
};

Expand Down Expand Up @@ -563,7 +563,7 @@ function servo(pin) {

module.exports = servo;
},{"./socket_utils.js":9}],9:[function(require,module,exports){
var socket = io.connect('http://localhost:8000/sensors');
var socket = io.connect(location.origin + '/sensors');
socket.on('error', function(err){
console.log(err);
});
Expand Down
4 changes: 2 additions & 2 deletions src/p5bots-server/lib/serial.js
Expand Up @@ -4,7 +4,7 @@ var sp = require('serialport'),
serialQ = [];

function serialDispatch(fn, args){
serialport.isOpen ?
serialport.isOpen() ?
fn.apply(null, args)
: serialQ.push({ func: fn, args: args });
}
Expand Down Expand Up @@ -36,7 +36,7 @@ exports.read = function serialRead(socket) {
exports.write = function serialWrite(socket) {
socket.on('serial write', function(arg){
function sWrite() {
serialport.write(arg, function(err, results) {
serialport.write(arg.arg, function(err, results) {
if (err) { console.log('Serial write error', err); }
socket.emit('serial write return', { results: results });
});
Expand Down

0 comments on commit 8a77fe5

Please sign in to comment.