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
+43-45Lines changed: 43 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,9 +113,10 @@ void loop() {
113
113
}
114
114
```
115
115
116
+
116
117
### Configuring the Programmable Button on the Opta™
117
118
118
-
The Opta™ has a programmable button, shown in the image below, and is identified as USER. It can be programmed using the Arduino IDE to fit your needs. To show how simple it is, let's create a sketch and program the button as a trigger to modify the status of the STATUS LEDs.
119
+
The Opta™ has a programmable button, shown in the image below, identified as USER. It can be programmed using the Arduino IDE to fit your needs. To show how simple it is, let's create a sketch and program the button as a trigger to modify the status of the STATUS LEDs.
119
120
120
121

121
122
@@ -239,56 +240,53 @@ The entire sketch can be found below, copy it into your IDE and upload it to you
239
240
*/
240
241
241
242
void setup() {
242
-
// Initialize Relays outputs
243
-
pinMode(D0, OUTPUT);
244
-
pinMode(D1, OUTPUT);
245
-
pinMode(D2, OUTPUT);
246
-
pinMode(D3, OUTPUT);
247
-
248
-
// Initialize Opta LEDs
249
-
pinMode(LED_D0, OUTPUT);
250
-
pinMode(LED_D1, OUTPUT);
251
-
pinMode(LED_D2, OUTPUT);
252
-
pinMode(LED_D3, OUTPUT);
243
+
// Initialize Relays outputs
244
+
pinMode(D0, OUTPUT);
245
+
pinMode(D1, OUTPUT);
246
+
pinMode(D2, OUTPUT);
247
+
pinMode(D3, OUTPUT);
248
+
249
+
// Initialize Opta LEDs
250
+
pinMode(LED_D0, OUTPUT);
251
+
pinMode(LED_D1, OUTPUT);
252
+
pinMode(LED_D2, OUTPUT);
253
+
pinMode(LED_D3, OUTPUT);
253
254
}
254
255
255
256
void loop() {
256
-
// Closes and opens the contact of relay 1 and turns on led 1
257
-
digitalWrite(D0, HIGH); // Sets the relay 1 on
258
-
digitalWrite(LED_D0, HIGH);
259
-
delay(1000);
260
-
digitalWrite(D0, LOW); // Sets the relay 1 off
261
-
digitalWrite(LED_D0, LOW);
262
-
delay(1000);
263
-
264
-
// Closes and opens the contact of relay 2 and turns on led 2
265
-
digitalWrite(D1, HIGH); // Sets the relay 2 on
266
-
digitalWrite(LED_D1, HIGH);
267
-
delay(1000);
268
-
digitalWrite(D1, LOW); // Sets the relay 2 off
269
-
digitalWrite(LED_D1, LOW);
270
-
delay(1000);
271
-
272
-
// Closes and opens the contact of relay 3 and turns on led 3
273
-
digitalWrite(D2, HIGH); // Sets the relay 3 on
274
-
digitalWrite(LED_D2, HIGH);
275
-
delay(1000);
276
-
digitalWrite(D2, LOW); // Sets the relay 3 off
277
-
digitalWrite(LED_D2, LOW);
278
-
delay(1000);
279
-
280
-
// Closes and opens the contact of relay 4 and turns on led 4
281
-
digitalWrite(D3, HIGH); // Sets the relay 4 on
282
-
digitalWrite(LED_D3, HIGH);
283
-
delay(1000);
284
-
digitalWrite(D3, LOW); // Sets the relay 4 off
285
-
digitalWrite(LED_D3, LOW);
286
-
delay(1000);
257
+
// Closes and opens the contact of relay 1 and turns on/off led 1
258
+
digitalWrite(D0, HIGH); // Sets the relay 1 on
259
+
digitalWrite(LED_D0, HIGH);
260
+
delay(1000);
261
+
digitalWrite(D0, LOW); // Sets the relay 1 off
262
+
digitalWrite(LED_D0, LOW);
263
+
delay(1000);
264
+
265
+
// Closes and opens the contact of relay 2 and turns on/off led 2
266
+
digitalWrite(D1, HIGH); // Sets the relay 2 on
267
+
digitalWrite(LED_D1, HIGH);
268
+
delay(1000);
269
+
digitalWrite(D1, LOW); // Sets the relay 2 off
270
+
digitalWrite(LED_D1, LOW);
271
+
delay(1000);
272
+
273
+
// Closes and opens the contact of relay 3 and turns on/off led 3
274
+
digitalWrite(D2, HIGH); // Sets the relay 3 on
275
+
digitalWrite(LED_D2, HIGH);
276
+
delay(1000);
277
+
digitalWrite(D2, LOW); // Sets the relay 3 off
278
+
digitalWrite(LED_D2, LOW);
279
+
delay(1000);
280
+
// Closes and opens the contact of relay 4 and turns on/off led 4
281
+
digitalWrite(D3, HIGH); // Sets the relay 4 on
282
+
digitalWrite(LED_D3, HIGH);
283
+
delay(1000);
284
+
digitalWrite(D3, LOW); // Sets the relay 4 off
285
+
digitalWrite(LED_D3, LOW);
286
+
delay(1000);
287
287
}
288
288
```
289
289
290
-
***Important: It is not possible to program the Opta™ while it is being powered with the power pins. You would need to disconnect the power supply, upload the program and then connect the power again.***
291
-
292
290
### Using Opta™ PLC's Inputs
293
291
294
292
Opta™ has 8 input pins that can be programmed to be used as analog or digital. The mapping between the marking on the Opta™ physical terminals (I1 to I8) and their definition in the core can be found below:
0 commit comments