Giter VIP home page Giter VIP logo

duino's People

Contributors

ecto avatar jarretth avatar natevw avatar nulltask avatar pi-uno avatar richkzad avatar rwaldron avatar setola avatar trobrock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

duino's Issues

Refactor serial binding

Sometimes signals will be sent from the Arduino before we bind for data events. To fix this, we'll have to refactor the autoconnection.

Move to newline parser

There is no need to parse on the JavaScript level at 115k baud when C can do it for us inside node-serialport.

GHSL-2020-118

Hello,

I am a member of the GitHub Security Lab (https://securitylab.github.com).

I've attempted to reach a maintainer for this project to report a potential security issue but have been unable to verify the report was received. Please could a project maintainer could contact us at [email protected], using reference GHSL-2020-118?

Thank you,
Kevin Backhouse
GitHub Security Lab

Bug in analogRead

Hi, there is a little bug in your board.analogRead, the code should be:

Board.prototype.analogRead = function (pin) {
    pin = this.normalizePin(pin);
    this.log('info', 'analogRead from pin ' + pin);
    this.write('04' + pin + this.normalizeVal(0));
}

I'm sorry I haven't created a pull request, but my repository is too messed up right now :D

Don't throw Errors

When no board is found, the board initialization routine throws an error inside an internal callback (board.js:88).

I propose emitting an "error" event instead of throwing.

Update: Sorry I didn't make a pull request initially, just didn't think that I'd implement it that quickly.

Hi, need an especific port

1345814061925 duino info attempting to find Arduino board
1345814061952 duino info found board at undefined
1345814061953 duino info binding serial events

events.js:48
throw arguments[1]; // Unhandled 'error' event

                   ^

Error: EACCES, open '/dev/usbmon0'

Hi, mi arduino its connect on /dev/ttyACM0, but duino can't open that.

du.ino process() incorrectly parses servo messages

To narrow this down, I added the following to handleServo:

  Serial.println(atoi(val));
  Serial.println(atoi(aux));

An example of the output:

1331739178315 duino receive 98A00265
1331739178315 duino receive ss
1331739178315 duino receive got signal
1331739178315 duino receive 26  /* atoi(val) */
1331739178315 duino receive 5   /* atoi(aux) */

If the message being parsed is 98A00265, then the expected values are:

1331739178315 duino receive 2    /* atoi(val) */
1331739178315 duino receive 65  /* atoi(aux) */

Otherwise, this block:

  } else if (atoi(val) == 2) {
    Serial.println("writing to servo");
    Serial.println(atoi(aux));
    servo.write(atoi(aux));
  }

...While never be entered.

The issue is here:

  strncpy(val, messageBuffer + 4, 3);
  val[3] = '\0';
  strncpy(aux, messageBuffer + 7, 3);
  aux[3] = '\0';

By changing this to:

  strncpy(val, messageBuffer + 4, 2);
  val[3] = '\0';
  strncpy(aux, messageBuffer + 6, 3);
  aux[3] = '\0';

... The servo values are written.

I will test this against all of the other modules + hardware and submit a patch when complete.

servo example not working

Love this framework. led.blink() works fine, but I can't get my servo to respond. The servo sweep example that comes with the arduino software works well so I don't think its the servo. Here is what I'm seeing in the log:

1337133106943 duino info attempting to find Arduino board
1337133106947 duino info set pin 13 mode to out
1337133106947 duino info serial not ready, buffering message: 0013001
Express server listening on port 3000 in development mode
1337133106957 duino info found board at /dev/tty.usbmodem411
1337133106957 duino info binding serial events
1337133107459 duino info board ready
1337133107459 duino info sending debug mode toggle on to board
1337133107465 duino write 9900001
1337133107467 duino info processing buffered messages
1337133107467 duino info writing buffered message
1337133107467 duino write 0013001
board ready, attaching servo { board:
{ debug: true,
writeBuffer: [],
_events: { ready: [Function], data: [Function] },
serial:
{ port: '/dev/tty.usbmodem411',
fd: 7,
readStream: [Object],
_events: [Object] } },
pin: '09',
_events: { attached: [Function] } }
1337133107469 duino write 980901


And then it stops. Thoughts? This is my code (pretty much straight from your example):

var arduino = require('duino'),
board = new arduino.Board({debug:true});

var led = new arduino.Led({
board: board,
pin: 13
});

var servo = new arduino.Servo({
board: board,
pin: 9
});

servo.on('attached', function(err) {
console.log('attached');

this.on('read', function(err, pos) {
console.log(pos);
});

this.on('detached', function(err) {
console.log('detached');
});

this.on('aftersweep', function(err) {
led.blink();

this.read();
this.detach();

});

this.sweep();
});

Button events are backwards

In lib/board.js:

// 1 is up
// 0 is down
if (m[1] == '1' && self.down) {
  self.down = false;
  self.emit('up');
}
if (m[1] == '0' && !self.down) {
  self.down = true;
  self.emit('down');
}

...which is backwards; button "up/unpressed" will be LOW/0/gnd and button "down/pressed" will be HIGH/1/5v

How do I access the examples?

Seems like it should be really easy, but I'm finding it confusing. How the heck do I access the examples?

It also isn't clear what needs to be running in order for the examples to work. Does srv.web.js need to be listening whilst srv.app.js is also running? I'm not sure.

I've tried:

node srv.web.js
info  - socket.io started
Listening on http://localhost:8080

http://localhost:8080/examples/walkLED.html //404

and this:

node srv.app.js

define(['kickstart', 'module', 'path', 'fs'], function (kickstart, module, pat
^
ReferenceError: define is not defined
    at Object.<anonymous> (/Users/joshuamcginnis/Dropbox/Joshua/sandbox/node-js-projects/noduino/srv.app.js:11:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

events.js:2725: Uncaught Error: Cannot open /dev/usbdev5.1

Hi,

just installed duino module

Here is my script

var arduino = require('duino'),
    board = new arduino.Board();

var led = new arduino.Led({
  board: board,
  pin: 13,
  debug: true
});

led.blink();

Here is the output

$ node duino-1.js
events.js:2725: Uncaught Error: Cannot open /dev/usbdev5.1

My Env: Ubuntu 12.04 LTS on MK803 mini PC (ARM), Node v0.8.14

How can I fix this?

Cannot use on Windows: `board.js` hard-coded *nix paths

Since board.js is trying to open a device from the *nix /dev folder, this library cannot possibly work on Windows.

On Windows, the path (the first argument to SerialPort constructor) is simply COM1, COM2 etc., which is the name of the COM port that the driver is using (also see this related thread on using CreateFile to open a serial port communication channel).

Once the path is correct, things work as expected. Very awesome!

In the long term, I would recommend a general-purpose config that allows for the path to be user-selected, or, if supported on the system, to be looked up automatically.

Duino doesn't work with 2 servos?

Hi--,
I attached 2 servo motors on my arduino (declaring servo1, servo2 in node server with different pin).
It always only works with the 2nd motor I attach, duino seems to ignore the first one?
Do you know how to fix this?

Thanks,

Push 0.0.9 to npmjs

The title says it all.
Current version in npmjs is 0.0.8, which doesn't have the device name fix.
Just for reference, i'm using 0.0.9 on a raspberry pi and it works perfectly
Thankyou

Error: Serialport not open

I am running example sensor.js and getting following error:

`1458988219328 duino info attempting to find Arduino board
1458988219400 duino info set pin A0 mode to in
1458988219403 duino info serial not ready, buffering message: 00A0000
1458988219455 duino debug attempting to open serial conn.: ttyACM0
1458988219462 duino info found board at /dev/ttyACM0
1458988219464 duino info binding serial events
1458988219471 duino info analogRead from pin A0
1458988219472 duino write 04A0000

Error: Serialport not open.
at SerialPortFactory.SerialPort.write (/home/pi/SmartHome/node_modules/duino/node_modules/serialport/serialport.js:288:17)
at Board.write (/home/pi/SmartHome/node_modules/duino/lib/board.js:163:17)
at Board.analogRead (/home/pi/SmartHome/node_modules/duino/lib/board.js:235:7)
at null. (/home/pi/SmartHome/node_modules/duino/lib/sensor.js:17:16)
at wrapper as _onTimeout
at Timer.listOnTimeout as ontimeout`

I will appreciate your help

Raspberry Pi

Hi,

has anyone tried to use duino with an Raspberry Pi (with Raspbian)?

The communication using duino is working perfectly on my Mac but if I use my app on the pi the serial communication does not work properly as you can see as follows:

1359682670868 duino info binding serial events
1359682670888 duino receiveA#C� >�2 $$$�
1359682671387 duino info board ready

What could be wrong? I tried baud rates of 9600 and 115200.

Define is not defined

Following the instructions I just keep getting a "define not defined" message. Example:

$ node examples/led.js
/Users/ruben/projects/arduino/noduino/node_modules/duino/lib/board.js:1
(function (exports, require, module, __filename, __dirname) { define(function(
                                                          ^
ReferenceError: define is not defined
    at Object.<anonymous> (/Users/ruben/projects/arduino/noduino/node_modules/duino/lib/board.js:1:63)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/ruben/projects/arduino/noduino/node_modules/duino/index.js:3:11)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.