Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DMDesign
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amanda Ghassaei
DMDesign
Commits
3a07d0e1
Commit
3a07d0e1
authored
9 years ago
by
Amanda Ghassaei
Browse files
Options
Downloads
Patches
Plain Diff
fixed node comm
parent
1f5eac07
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/nodeServer.js
+7
-3
7 additions, 3 deletions
node/nodeServer.js
with
7 additions
and
3 deletions
node/nodeServer.js
+
7
−
3
View file @
3a07d0e1
...
...
@@ -18,7 +18,7 @@ var io = require('socket.io').listen(8080);
//defaults
var
portName
=
null
;
var
currentPort
=
null
;
var
baudRate
=
96
00
;
var
baudRate
=
1152
00
;
//io.sockets.on('connection', function (socket) {
// socket.emit('baudRate', baudRate);
...
...
@@ -50,8 +50,12 @@ io.on('connection', function(socket){
});
socket
.
on
(
'
dataOut
'
,
function
(
data
){
data
+=
'
\n
'
;
console
.
log
(
"
Sending data:
"
+
data
);
currentPort
.
write
(
new
Buffer
([
parseInt
(
data
)]));
currentPort
.
write
(
new
Buffer
(
data
),
function
(
err
,
res
)
{
if
(
err
)
onPortError
(
err
);
});
// currentPort.write(new Buffer([parseInt(data)]));//write byte
});
socket
.
on
(
'
flush
'
,
function
(){
...
...
@@ -145,7 +149,7 @@ io.on('connection', function(socket){
}
function
onPortData
(
data
){
//
console.log(data);
console
.
log
(
data
);
socket
.
emit
(
"
dataIn
"
,
data
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment