This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RE: Connecting to the L293D and Making Motors Understand Their Orders/Seth

Other Parts Discussed in Thread: L293D

Hello,

I am currently using a L293D driver/H-Bridge for my efforts. Does anyone out there use their L293D for making 12 VDC batteries run one or two motors (ranges from 6 V to 12 V)? I am working on a book for the BeagleBone Black and I have come across some hardware issues with my L293D.

The issue probably pertains to me but I have yet to put BoneScript on my BBB (BeagleBone Black) in my root folder. The people that set up the BBB and their background sure is greater than mine. This is why I keep learning more. One day, I would also like to know something that I can use in life, e.g. math from programming, structures in programming, and/or separate software languages and their respective libraries.

So...I have this MCU board. I used the software from the book and came up empty. No satisfaction! Besides the lack of satisfaction, I have tried multiple times and still have a "no-go."

Here is the software in case you get your BoneScipt and Socket.io to download into your /root folder.

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

app.listen(8080);
// 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 based on version number

console.log('Server running on: http://' + getIPAddress() + ':8080');
//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('index.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';
} 
  • That is the software.
  • I use this software and I get these error codes...
    • Option log level not valid See the README
    • Option browser client not valid See the README
    • Option browser client etag not valid See the README
      • server running at 192.168.x.x:8080
      • /root/node_modules/bonescript/src/hw_mainline.js:84
      • if (!pinmux) { throw p + " was not found under " + my.js_ocp(); }
    • ocp: P9_14_pinmux was not found under /sys/devices/platform/ocp

Here is the GitHub.com page: github.com/ChristopherRush/BB-Evil-Genius

I have been using this software and book for a web browser based robot that basically controls motors.

I am on project 16. So...if you want, please add any suggestions or advice. I sure could use some feedback and/or a partner to work with me on this project.

Seth

P.S. Again, thank you for your support.