-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create mhz19.js #54
base: master
Are you sure you want to change the base?
Create mhz19.js #54
Conversation
var mhz19 = require('@amperka/mhz19.js').connect({ rx: P0, tx: P1, speed: 9600, port: Serial3 }); console.log( mhz19.read() );
Привет! В целом всё норм, но есть комментарии. "rules": { "globals": { |
modules/@amperka/mhz19.js
Outdated
MHZ19.prototype.abc_on = function() { this._serial.write("\xFF\x01\x79\xA0\x00\x00\x00\x00\xE6"); } | ||
MHZ19.prototype.abc_off = function() { this._serial.write("\xFF\x01\x79\x00\x00\x00\x00\x00\x86"); } | ||
MHZ19.prototype.read = function() { this._serial.write("\xFF\x01\x86\x00\x00\x00\x00\x00\x79"); | ||
var data = this._serial.read(9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше использовать хендлеры для обработки сообщений UART
ser.on("data", function(d) {
…
});
var mhz19 = require('@amperka/mhz19.js').connect({tx: P1, rx: P0, port: Serial3, speed: 9600});
var mhz19 = require('@amperka/mhz19.js').connect({ rx: P0, tx: P1, speed: 9600, port: Serial3 });
console.log( mhz19.read() );