File tree 2 files changed +11
-14
lines changed
2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const parser = new parsers.Readline({
9
9
delimiter : '\r\n'
10
10
} ) ;
11
11
12
- var port = new SerialPort ( '/dev/tty.usbmodem1421 ' , {
12
+ var port = new SerialPort ( '/dev/tty.wchusbserialfa1410 ' , {
13
13
baudRate : 9600 ,
14
14
dataBits : 8 ,
15
15
parity : 'none' ,
@@ -40,4 +40,4 @@ parser.on('data', function(data) {
40
40
41
41
} ) ;
42
42
43
- app . listen ( 3000 ) ;
43
+ app . listen ( 3000 ) ;
Original file line number Diff line number Diff line change 3
3
< head >
4
4
5
5
< script src ='https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js '> </ script >
6
- < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js "> </ script >
7
6
8
7
< script >
9
8
10
- $ ( document ) . ready ( function ( ) {
11
-
12
- var socket = io ( ) ;
9
+ var socket = io ( ) ;
13
10
14
- socket . on ( 'data' , function ( data ) {
15
-
16
- console . log ( data ) ;
17
-
18
- $ ( '#sample' ) . css ( 'opacity' , data / 100 ) ;
19
-
20
- } ) ;
11
+ socket . on ( 'data' , function ( data ) {
12
+
13
+ console . log ( data ) ;
21
14
15
+ document . getElementById ( 'sample' ) . style . opacity = data / 100 + "%" ;
16
+
22
17
} ) ;
23
18
24
19
</ script >
36
31
</ head >
37
32
< body >
38
33
34
+ < h1 > Communicating from an Arduino to Node.js</ h1 >
35
+
39
36
< div id ="sample "> </ div >
40
37
41
38
</ body >
42
- </ html >
39
+ </ html >
You can’t perform that action at this time.
0 commit comments