File tree 3 files changed +111
-97
lines changed
3 files changed +111
-97
lines changed Original file line number Diff line number Diff line change 2
2
Modbus slave simple example
3
3
4
4
Control and Read Arduino I/Os using Modbus serial connection.
5
-
5
+
6
6
This sketch show how to use the callback vector for reading and
7
7
controleing Arduino I/Os.
8
-
8
+
9
9
* Controls digital output pins as modbus coils.
10
10
* Reads digital inputs state as discreet inputs.
11
11
* Reads analog inputs as input registers.
@@ -44,14 +44,14 @@ void setup() {
44
44
pinMode (11 , OUTPUT);
45
45
pinMode (12 , OUTPUT);
46
46
pinMode (13 , OUTPUT);
47
-
47
+
48
48
/* register handler functions
49
49
* into the modbus slave callback vector.
50
50
*/
51
51
slave.cbVector [CB_WRITE_COIL] = writeDigitlOut;
52
52
slave.cbVector [CB_READ_COILS] = readDigitalIn;
53
53
slave.cbVector [CB_READ_REGISTERS] = readAnalogIn;
54
-
54
+
55
55
// start slave at baud 9600 on Serial
56
56
slave.begin ( BAUDRATE );
57
57
}
@@ -62,7 +62,7 @@ void loop() {
62
62
* on a request, handle the request.
63
63
* if the request has a user handler function registered in cbVector
64
64
* call the user handler function.
65
- */
65
+ */
66
66
slave.poll ();
67
67
}
68
68
You can’t perform that action at this time.
0 commit comments