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
The IRQ inputs of the Edge Control can be used through the built-in functions of the Arduino programming language. The configuration of an interrupt pin is done in the `setup()` function with the function `attachInterrupt()` as shown below:
322
322
@@ -399,10 +399,10 @@ The Edge Control has **four 4-20mA input pins**, mapped as follows:
Every 4-20mA input can be read through the built-in functions of the Arduino programming language. They are sampled the same way as the 0-5V analog inputs but the input value is read via a 220 ohm resistor and a +19V reference.
408
408
@@ -510,22 +510,22 @@ The Edge Control has **16 Watermark sensor inputs**, mapped as follows:
Watermark sensors are capable of measuring the physical force holding the water in the soil. Those measurements are correlated with the effort plants have to make to extract water from the soil, a really interesting data for agricultural applications.
531
531
@@ -766,14 +766,14 @@ The board provides a total of 16 latching ports divided in 2 types:
These outputs can handle up to 3.3 A, so they can manage loads directly without problem. Motorized valves or solenoid latching valves are perfect examples of devices to control with these outputs.
779
779
@@ -792,14 +792,14 @@ If you want to know more about using this outputs, follow our guide: [Connecting
These outputs must be connected to external devices through third-party protection/power circuits with high impedance inputs (max +/- 25 mA). They are suitable for custom applications where just the activation signal is needed. For example for using external relay modules or direct connections with other control devices like PLC inputs.
805
805
@@ -856,10 +856,10 @@ The Edge Control has **four solid state relay outputs**, mapped as follows:
This relay outputs are suitable for AC loads with a current draw below 2.5A and a 24V AC power supply.
865
865
@@ -874,7 +874,7 @@ Relay.off(RELAY_CH01); // this command opens the channel 1 relay contacts
874
874
875
875
The example code shown below closes and opens the first channel `Relay Contact` repetitively, turning on and off the connected load:
876
876
877
-
```cpp
877
+
```arduino
878
878
#include "Arduino_EdgeControl.h"
879
879
880
880
// #define SSR_POLL
@@ -965,7 +965,7 @@ To power on or off a power rail the `Power.on(<rail>)` and `Power.off(<rail>)` f
965
965
966
966
The different commands and controllable power rails will be specified in the list below:
967
967
968
-
```cpp
968
+
```arduino
969
969
Power.on(PWR_VBAT); // turns on the 12V power rails for the "Latching Outputs"
970
970
Power.on(PWR_3V3); // turns on the 3.3V power rail for the micro SD Card
971
971
Power.on(PWR_19V); // turns on the 19V power rail for the 4-20mA sensors reference
@@ -997,7 +997,7 @@ To display text, we use the `LCD.print(text)` function.
997
997
998
998
The example code below prints "Edge Control" in the first row and starts a seconds counter in the second one:
999
999
1000
-
```cpp
1000
+
```arduino
1001
1001
#include <Arduino_EdgeControl.h>
1002
1002
1003
1003
void setup() {
@@ -1026,7 +1026,7 @@ The Enclosure Kit includes a push button so you can interact with the device in
1026
1026
1027
1027
To read the button state we can use the built-in functions of the Arduino programming language. We first need to define it as an input using the `POWER_ON` macro.
1028
1028
1029
-
```cpp
1029
+
```arduino
1030
1030
pinMode(POWER_ON, INPUT); // the push button is addressed to the MCU input as "POWER_ON"
1031
1031
```
1032
1032
@@ -1036,7 +1036,7 @@ The state of the button can be read as usual with the `digitalRead(POWER_ON)` fu
1036
1036
1037
1037
In the example code below, we will attach the input to an interrupt and increase a counter with every tap shown in the LCD.
1038
1038
1039
-
```cpp
1039
+
```arduino
1040
1040
#include <Arduino_EdgeControl.h>
1041
1041
1042
1042
// Keep track of toggle-style press with an ISR
@@ -1086,21 +1086,21 @@ In the example code, there is a .h file called Helpers that includes very useful
1086
1086
Initially, you must set the current time as a reference for the RTC. This is made just once and can be done using the function setEpoch([Current Unix Time](https://www.unixtimestamp.com/)):
1087
1087
1088
1088
1089
-
```cpp
1089
+
```arduino
1090
1090
RealTimeClock.setEpoch(Unix Time); // You can use the timestamp generated on https://www.unixtimestamp.com/. Be aware that the time found on the webpage is UTC.
1091
1091
```
1092
1092
1093
1093
The `time(NULL)` function returns the Unix time (seconds since Jan 1st 1970), this is perfect for cloud and servers data logging.
1094
1094
1095
-
```cpp
1095
+
```arduino
1096
1096
getRTDateTime(); // 2023-09-30 16:33:19
1097
1097
getRTCTime(); // 16:33:19
1098
1098
getRTCDate(); // 2023-09-30
1099
1099
```
1100
1100
1101
1101
Also, you can use these more specific functions to retrieve the time in a custom way:
1102
1102
1103
-
```cpp
1103
+
```arduino
1104
1104
RealTimeClock.getYears(); //return the current year
1105
1105
RealTimeClock.getMonths(); //return the current month
1106
1106
RealTimeClock.getDays(); //return the current day
@@ -1126,19 +1126,19 @@ The NINA-B306 has two I2C ports, the I2C_1 is the one shared with the internal c
1126
1126
1127
1127
To use I2C communication, include the `Wire` library at the top of your sketch. The `Wire` library provides functions for I2C communication:
1128
1128
1129
-
```cpp
1129
+
```arduino
1130
1130
#include <Wire.h>
1131
1131
```
1132
1132
In the setup() function, initialize the I2C library:
1133
1133
1134
-
```cpp
1134
+
```arduino
1135
1135
// Initialize the I2C communication
1136
1136
Wire.begin();
1137
1137
```
1138
1138
1139
1139
To transmit data to an I2C-compatible device, you can use the following commands:
1140
1140
1141
-
```cpp
1141
+
```arduino
1142
1142
// Replace with the target device's I2C address
1143
1143
byte deviceAddress = 0x05;
1144
1144
@@ -1162,7 +1162,7 @@ Wire.endTransmission();
1162
1162
```
1163
1163
To read data from an I2C-compatible device, you can use the `requestFrom()` function to request data from the device and the `read()` function to read the received bytes:
1164
1164
1165
-
```cpp
1165
+
```arduino
1166
1166
// The target device's I2C address
1167
1167
byte deviceAddress = 0x05;
1168
1168
@@ -1186,7 +1186,7 @@ In the example code below, we are going to communicate the `Edge Control` with a
0 commit comments