You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,25 +46,25 @@ The above code creates a webpage with two buttons. When the buttons are clicked
46
46
47
47
Before we setup the Node.js server we need to know the name of the serialport your Arduino is attached to. You can find the name of your serialport, it will look something like `/dev/tty.wchusbserialfa1410`. On a Mac using the Terminal and entering the following command:
48
48
49
-
```
49
+
```sh
50
50
ls /dev/{tty,cu}.*
51
51
```
52
52
53
53
On a PC you can use the command line and the following command:
54
54
55
-
```
55
+
```sh
56
56
chgport
57
57
```
58
58
59
-
On my PC when I use the `chgport` command I get the following output:
59
+
On a Windows machine the `chgport` command would result in the following:
60
60
61
-
```
61
+
```sh
62
62
AUX = \DosDevices\COM1
63
63
COM1 = \Device\Serial0
64
64
COM3 = \Device\Serial2
65
65
```
66
66
67
-
In my Node.js I would use just`COM3` as my serialport string.
67
+
My Node.js will require the use of`COM3` as the serialport string.
68
68
69
69
If you're not sure which one is your Arduino, just disconnet your Arduino and execute the cpommand again and take note of which port is no longer on the list.
70
70
@@ -117,13 +117,15 @@ app.listen(3000);
117
117
118
118
The above code uses Socket.io to listen for a message from the HTML/JavaScript webpage and then simply passes on the message to the connected Arduino.
119
119
120
-
> Note: Make sure to change the name of the serialport.
120
+
> **Note**
121
+
>
122
+
> Make sure to change the name of the serialport.
121
123
122
124
## The Arduino
123
125
124
126
Using [Arduino Create](https://create.arduino.cc/editor) create the following sketch and upload it to your Arduino.
125
127
126
-
```csharp
128
+
```cpp
127
129
int lightPin = 2;
128
130
129
131
voidsetup()
@@ -156,13 +158,13 @@ void loop() {
156
158
157
159
The previous code will listen to the serialport for an incoming message. Once a message is received, if the message is a one the light will turn on, if the message is a zero the light will turn off.
158
160
159
-
[View the Arduino code on Arduino Create](https://create.arduino.cc/editor/professoradam/af5288bf-00cc-406c-844e-f20485fa2df8/preview)
161
+
> [View the Arduino code on Arduino Create](https://create.arduino.cc/editor/professoradam/af5288bf-00cc-406c-844e-f20485fa2df8/preview)
160
162
161
163
You will need to setup the following circuit using your Arduino:
0 commit comments