RE: Working Out of Books/Seth

Hello,

I am working out of a book. It is called “30 Beaglebone Black Projects for the Evil Genius.” The author has a GitHub.com page online at https://github.com/ChristopherRush/BB-Evil-Genius. I am on Project16.js and Project16.html. I have gotten scores of error codes. I have been unsuccessful updating my Bonescript and Socket.io languages on the BBGW.

If there are any people out there working out of this specific book, please join in. I can sure use some advice and further understanding.

I know it is me that cannot make the software work with my current configuration(s).

Seth

P.S. If you need additional info, please contact me. Thank you and Geaux Cajuns!

`

var app = require(‘http’).createServer(handler);
var io = require(‘socket.io’).listen(app);
var fs = require(‘fs’);
var b = require(‘bonescript’);

app.listen(1000);
// socket.io options go here
io.set(‘log level’, 2); // reduce logging - set 1 for warn, 2 for info,3 for debug
io.set(‘browser client minification’, true); // send minified client
io.set(‘browser client etag’, true); // apply etag caching logic basedon version number

console.log(‘Server running on: http://’ + getIPAddress() + ‘:1000’);
//pwm pin
var pwmPin1 = “P9_14”;
var pwmPin2 = “P8_19”;

//motor 1
var ain1Pin = “P9_13”;
var ain2Pin = “P9_15”;

//motor 2
var ain1Pin2 = “P8_10”;
var ain2Pin2 = “P8_12”;

// configure pins
b.pinMode(pwmPin1, b.OUTPUT);
b.pinMode(pwmPin2, b.OUTPUT);
b.pinMode(ain1Pin, b.OUTPUT);
b.pinMode(ain2Pin, b.OUTPUT);
b.pinMode(ain1Pin2, b.OUTPUT);
b.pinMode(ain2Pin2, b.OUTPUT);

function handler (req, res) {
fs.readFile(‘Project 16.html’, // load html file
function (err, data) {
if (err) {
res.writeHead(500);
return res.end(‘Error loading index.html’);
}
res.writeHead(200);
res.end(data);
});
}

io.sockets.on(‘connection’, function (socket) {
// listen to sockets and write analog values to PWM pins
socket.on(‘pwmPin’, function (data) {
console.log(data);
if (data.value >50){
forwards((data/100 - 0.5) * 2);
console.log(“Forwards”);
}
else {
backwards ((0.5 - data/100) * 2);
console.log(“backwards”);
}
});
});

function forwards(duty) {
var value = duty;
//Arm motors
b.analogWrite(pwmPin1, value);
b.analogWrite(pwmPin2, value);
//Write values
b.digitalWrite(ain1Pin, 1);
b.digitalWrite(ain2Pin, 0);
b.digitalWrite(ain1Pin2, 1);
b.digitalWrite(ain2Pin2, 0);
}

function backwards(duty) {
var value = duty;
//Arm motors
b.analogWrite(pwmPin1, value);
b.analogWrite(pwmPin2, value);
//Write values
b.digitalWrite(ain1Pin, 0);
b.digitalWrite(ain2Pin, 1);
b.digitalWrite(ain1Pin2, 0);
b.digitalWrite(ain2Pin2, 1);
}
// Get server IP address on LAN
function getIPAddress() {
var interfaces = require(‘os’).networkInterfaces();
for (var devName in interfaces) {
var iface = interfaces[devName];
for (var i = 0; i < iface.length; i++) {
var alias = iface[i];
if (alias.family === ‘IPv4’ && alias.address !== ‘127.0.0.1’ &&
!alias.internal)
return alias.address;
}
}
return ‘0.0.0.0’;
}

`

and here is the HTML software for this project…

`

BBB and Geaux!

BeagleBone Black

Geaux!

`

If there are some software debuggers out there that know how to work around my error codes, let a brother know. Thank you.

Seth

Hello…

Here are the ERRORS:

  • This error was from running the software in the root directory as a superuser.

Option log level is not valid. Please refer to the README.
Option browser client minification is not valid. Please refer to the README.
Option browser client etag is not valid. Please refer to the README.
Server running on: http://192.168.7.2:1000

/root/node_modules/bonescript/src/hw_mainline.js:84
if(!pinmux) { throw p + " was not found under " + my.is_ocp(); }
^
ocp:P9_14_pinmux was not found under /sys/devices/platform/ocp

I used to run this software in the Cloud9 IDE but the software, syntax errors are the same now. The other day, I received different error codes in the Cloud9 IDE. I cannot produce those right now. The errors have changed.

Seth