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: content/hardware/05.pro-solutions/solutions-and-kits/opta/tutorials/getting-started/content.md
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: 'Getting Started With the Arduino Opta®'
2
+
title: 'Getting Started With the Arduino Opta™'
3
3
description: 'Get started with the Opta™ and get to know some of its features.'
4
4
difficulty: beginner
5
5
tags:
@@ -20,7 +20,7 @@ hardware:
20
20
21
21
Opta™ is a robust micro PLC solution with many engaging features. In this tutorial we will go through the setup of Opta™ with the Arduino IDE and explain how to use its basic features, showing through examples how to program the LEDs on the device, how to use the programmable button, as well as controlling its inputs and outputs.
22
22
23
-

23
+

24
24
25
25
## Goals
26
26
@@ -32,10 +32,10 @@ Opta™ is a robust micro PLC solution with many engaging features. In this tuto
- Power supply of 12-24V DC, 1A (optional if not running the section related to the relays)
38
+
- Power supply of 12-24V DC, 1A (optional if not running the section related to the relays) (x1)
39
39
- Analog inputs (optional, alternatively the section related to analog inputs will work but reading random values)
40
40
41
41
## Instructions
@@ -54,7 +54,7 @@ Now you are ready to upload sketches to the Opta™ via the Arduino IDE.
54
54
Once the IDE and the core are installed, let's warm up by uploading a first sketch to your Opta™. We will be using a modified version of the classical Arduino blink sketch to put your device to work and test if everything is set properly.
55
55
Let's create a simple blink sketch that will blink the four STATUS LEDs on the Opta™, highlighted in the image below.
56
56
57
-

57
+

58
58
59
59
All the STATUS LEDs on the device are defined in the core of the PLC.
60
60
Hereafter you can see the correspondence between each of them as identified in the core and their labeling on the front panel of the product:
@@ -64,7 +64,7 @@ Hereafter you can see the correspondence between each of them as identified in t
64
64
-`LED_D2`: STATUS 3
65
65
-`LED_D3`: STATUS 4
66
66
-`LED_RESET`: LED above the reset button
67
-
-`LED_USER`: LED above the user button (only available on the Arduino Opta WiFi, SKU: AFX00002)
67
+
-`LED_USER`: LED above the user button (only available on the variant with Wi-Fi® and Bluetooth® Low Energy)
68
68
69
69
Select the correct **board** and **port** in the **Tools** section.
70
70
Copy the sketch below into the Arduino IDE sketch editor, then upload it to Opta™.
@@ -105,9 +105,9 @@ void loop() {
105
105
106
106
Opta™ has a programmable button, shown on the image below and identified as USER. It can be programmed using the Arduino IDE to fit your needs. To show how much simple is to use it, let's create a sketch and program the button as a trigger to modify the status of the STATUS LEDs.
107
107
108
-

108
+

109
109
110
-
The button is defined in the core as `BTN_USER`: 'HIGH' as default (not pressed), and 'LOW' when pressed. The new sketch will turn on one by one the LEDs when the button is pressed, and then start over when all the lights have been turned on. Below you can find the entire sketch, where a simple [Switch (case) Statement](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) is used, and an image highlighting where the USER button is located on the device.
110
+
The button is defined in the core as `BTN_USER`: 'HIGH' as default (not pressed), and 'LOW' when pressed. The new sketch will turn the STATUS LEDs on one by one when the button is pressed, and then start over when all the lights have been turned on. Below you can find the entire sketch, where a simple [Switch (case) Statement](https://www.arduino.cc/reference/en/language/structure/control-structure/switchcase/) is used, and an image highlighting where the USER button is located on the device.
111
111
112
112
```arduino
113
113
int buttonState = 0;
@@ -164,13 +164,13 @@ void changeLights() {
164
164
165
165
Once the sketch is uploaded, you can see that an additional LED is turned on each time you press the button, following the sequence:
166
166
167
-
| Interaction | Result |
168
-
| ------------ | ---------------------- |
169
-
| First press | LED 1 ON. |
170
-
| Second press | LEDs 1 and 2 ON. |
171
-
| Third press |LEDS 1, 2 and 3 ON. |
172
-
| Fourth press |LEDS 1, 2, 3 and 4 ON. |
173
-
| Fifth press | All leds off and back. |
167
+
| Interaction | Result |
168
+
| ------------ | -----------------------------|
169
+
| First press |STATUS LED 1 ON. |
170
+
| Second press |STATUS LEDs 1 and 2 ON. |
171
+
| Third press |STATUS LEDs 1, 2 and 3 ON. |
172
+
| Fourth press |STATUS LEDs 1, 2, 3 and 4 ON. |
173
+
| Fifth press | All STATUS LEDs off and back. |
174
174
175
175
176
176
### Using Out Relays
@@ -196,7 +196,7 @@ The “clean” contact also allows carrying a different power system or type of
196
196
197
197

198
198
199
-
Let's run a simple sketch to test the output relays on Opta™: in this sketch all the 4 relays are closing and reopening their contacts and after each relay's cycle a led, will be turned on to provide a visual feedback.
199
+
Let's run a simple sketch to test the output relays on Opta™: in this sketch all the 4 relays are closing and reopening their contacts and after each relay's cycle a led will be turned on to provide visual feedback.
200
200
To activate the relays and run this sketch you need to provide Opta™ with a voltage from 12 to 24 V DC by connecting it a proper power supply.
201
201
202
202
Opta™ has dedicated terminals for power supply located in the upper part of Opta™ and next to the inputs. They are duplicated to help the user to connect the power supply and any common part to the input terminals but they have the same potential (upon polarity).
@@ -329,7 +329,7 @@ void loop() {
329
329
}
330
330
```
331
331
332
-
Once you have uploaded the code, open the serial monitor to see the values read in each analog input. Ig you have connected a device with an analog voltage value in I1, I2, and/or I3 you will see the voltage or analog value of each of the signals. In case you did not connect anything to the analog inputs, you will see how the values oscillate between 0V and a very small value because the pins are floating.
332
+
Once you have uploaded the code, open the serial monitor to see the values read in each analog input. If you have connected a device with an analog voltage value in I1, I2, and/or I3 you will see the voltage or analog value of each of the signals. In case you did not connect anything to the analog inputs, you will see how the values oscillate between 0V and a very small value because the pins are floating.
333
333
334
334
You may notice from the output values that when the maximum value of 10V is reached, the corresponding numerical value is not 4095 as the maximum value with 12 bits resolution should be. The reason is that there is a precautional margin taken on the maximum voltage level applicable to the inputs to preserve the integrity of the microcontroller.
0 commit comments