Skip to content

Commit 87438e5

Browse files
canchebagurTaddyHCjcarolinaresMatteo-it
authored
[PC-1221] - Portenta C33 Energy Meter Application Note (#449)
* Initial commit - Added library management section for programming introduction for Arduino PLC IDE tutorial * Content minor update w/ gif * Tutorial content update * Tutorial content update * Tutorial content update * Tutorial content update * Tutorial content update * Tutorial content update * Tutorial content minor update * Tutorial content minor update * Update content/software/plc-ide/tutorials/plc-programming-introduction/content.md Co-authored-by: Julián Caro Linares <j.carolinares@arduino.cc> * Update content/software/plc-ide/tutorials/plc-programming-introduction/content.md Co-authored-by: Julián Caro Linares <j.carolinares@arduino.cc> * Update content/software/plc-ide/tutorials/plc-programming-introduction/content.md Co-authored-by: Julián Caro Linares <j.carolinares@arduino.cc> * Tutorial content post-update * Tutorial content post-update * Tutorial content minor post-update * dotenv dep fix (#1094) * dotenv dep fix * test dep * 1.8.98 * update dep * Update README.md (#1095) * Initial commit * Application note content update * Application note content update * Application note content update * Content update * Content update * Content update * Content update * Application note content update * Christopher review * Application note content struct readjustment * Application note content update * Math calculations * Math calculations update * Image folder location update * Spelling check * Math calculations update * Content update * Graphics update * Example sketch updated * Code and graphics update * Spelling fix * Application note content update * Code explanation added * Conclusion added * Application note content patch * Application note content patch * Application note content patch * Application note content update * Application note content minor patch * Application note content patch * Application note content minor update - Mobile cloud reference * Feedback changes --------- Co-authored-by: TaddyHC <k.hochung@arduino.cc> Co-authored-by: TaddyHC <94547080+TaddyHC@users.noreply.github.com> Co-authored-by: Julián Caro Linares <j.carolinares@arduino.cc> Co-authored-by: Matteo Marsala <m.marsala@arduino.cc> Co-authored-by: jcarolinares <jcarolinares@gmail.com>
1 parent d7a8ab5 commit 87438e5

File tree

17 files changed

+550
-14
lines changed

17 files changed

+550
-14
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ Code snippets can be included by using the triple backticks syntax e.g. ` ```ard
8787
arduino, bash, markup, clike, c, cpp, css, css-extras, javascript, jsx, js-extras, coffeescript, diff, git, go, graphql, handlebars, json, less, makefile, markdown, objectivec, ocaml, python, reason, sass, scss, sql, stylus, tsx, typescript, wasm, yaml
8888
```
8989

90+
### Including Code Blocks fetching Github pages
91+
92+
CodeBlocks are custom components that can be added directly in the Markdown on docs-content.
93+
Using this component, the code block will be fetched directly from Github pages.
94+
95+
Syntax:
96+
` <CodeBlock url=”https://github.com/example” className="{language}"/>`
97+
98+
Broken URL will show error alert. URL must be in Github domain and must be public.
9099

91100
## Previewing Changes
92101

content/hardware/04.pro/boards/portenta-c33/tutorials/energy-meter-application-note/content.md

Lines changed: 494 additions & 0 deletions
Large diffs are not rendered by default.

content/software/plc-ide/tutorials/plc-programming-introduction/content.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Programming Introduction With Arduino® PLC IDE'
2+
title: 'Programming Introduction with Arduino® PLC IDE'
33
difficulty: intermediate
44
description: "Create programs with all the IEC-61131-3 languages on the Arduino PLC IDE."
55
tags:
@@ -27,16 +27,18 @@ The goals of this tutorial are:
2727

2828
### Required Hardware and Software
2929

30-
- [Arduino® Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control)
30+
- [Portenta Machine Control](https://store.arduino.cc/products/arduino-portenta-machine-control)
3131

3232
## Common Features
33+
3334
### Variables Addition
3435

3536
There are 2 types of variables:
3637
* Global variables: All of the 5 programs can access it.
3738
* Local variables: Only one program has access to it.
3839

3940
#### Global Variable
41+
4042
Click inside the **Project** tab and click the **Global_vars** section, a table is available to see the full list of global variables on your project.
4143

4244
To add a new one, right-click on the table and click the **insert** button.
@@ -61,6 +63,7 @@ Following the same steps explained previously, you can right-click the table, an
6163
A new variable will be added with default settings, double-click each of them to change them as you need.
6264

6365
### Adding Blocks
66+
6467
The blocks are features or functions available from libraries and the PLC IDE.
6568

6669
These will help you to perform tasks, like AND gates, ADD function, etc...
@@ -71,6 +74,7 @@ To add a block to your program (only possible with LD, SFC, FBD) you can drag an
7174
Once you drag and drop it on your canvas it will generate a block with some input and output pins fully customizable, most of the time you can right-click the block and add more pins in case you need more than the default.
7275

7376
### Task Attachment
77+
7478
Once you have your programs you can attach them to a task inside the runtime.
7579

7680
There are 4 Tasks:
@@ -100,10 +104,28 @@ Inside the **Tool window** you can drag and drop variables, or click the **Inser
100104

101105
![Watch a variable](assets/watch.png)
102106

107+
### Library Management
108+
109+
In contrast to the conventional Arduino IDE, the PLC IDE manages the library add-on and usage differently. To add the desired library, go to **Resources** tab and click the **Libraries** listed under the **Sketch**.
110+
111+
![Adding a library to the PLC IDE Arduino Sketch](assets/plcide-library-management.gif)
112+
113+
With the 'Sketch Libraries' window open, click the **Add** option and fill out the library name. You will have to fill in the needed library version as well.
114+
115+
For example, if you want to add the 1.1.1 version of the 'Arduino_MachineControl' library, respective information must be introduced to its fields accordingly.
116+
117+
It is possible to find this information using the [Arduino Library List](https://www.arduinolibraries.info/) or referencing the indexed library on your development environment if you have downloaded it to use within Arduino IDE. By navigating manually to the local libraries directory on your development environment, you can access the meta-data from the 'library.properties' of the desired library.
118+
119+
***Currently only publicly available libraries can be added to the PLC IDE Arduino Sketch, and you can check its availability by searching in the [Arduino Library List](https://www.arduinolibraries.info/).***
120+
121+
Once you have followed the previous steps, the libraries will be available for use. A library of choice can be removed by clicking on the **Remove** option within the 'Sketch Libraries' window.
122+
103123
## Sample Program
124+
104125
The program will be a simple counter, increasing the count by X over time.
105126

106127
### Arduino Sketch
128+
107129
```cpp
108130
int count = 0;
109131
const int addition = 1;
@@ -115,6 +137,7 @@ void loop(){
115137
```
116138

117139
### IEC-61131-3 Languages
140+
118141
To create a new program open your project tab, go to the toolbar **Project > New object > New program**, set a name for your program and select its language.
119142

120143
![New program from Project's drop-down menu](assets/newProgram.png)
@@ -131,6 +154,7 @@ There are 5 languages available:
131154
* Function Block Diagram (FBD)
132155

133156
### Structured Text
157+
134158
This language is similar to C, the code to assign a value to a variable is the following:
135159
```
136160
count := count + addition;
@@ -139,6 +163,7 @@ count := count + addition;
139163
![Structured Text counter program](assets/STprogram.png)
140164

141165
### Instruction List
166+
142167
This programming language is similar to Assembly programming.
143168

144169
The code for a counter script is:
@@ -151,6 +176,7 @@ ST count
151176
![Instruction List counter program](assets/ILprogram.png)
152177

153178
### Ladder Diagram
179+
154180
This programming environment is based on lines and blocks, a line has a path from left to right that needs to pass all the in between blocks in order to continue towards the right, if it does pass all the different blocks (like AND gates) it will end on the right on a brackets symbol (coil) triggering whatever you have set up to do, which could be for example a relay latching to Normally-Open (NO).
155181

156182
This is how a counter program looks:
@@ -160,18 +186,21 @@ Here is a video doing that from scratch:
160186
<iframe width="100%" height="415" src="https://www.youtube.com/embed/0EdATSgIc9o" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
161187

162188
### Sequential Function Chart
189+
163190
This language approaches the script in a similar way as a flowchart, meaning you have blocks that do some work, you check the result of that work, and afterward you keep flowing with the choices.
164191

165192
SFC language can not interact directly with the machine, meaning you can not make an output be OFF directly, to do so you will need to create **actions**
166193

167194
#### Actions
195+
168196
An action is a script in another language (i.e. structured text) that performs the work, this will get triggered depending on the chart.
169197

170198
To create one go to your project tree, right-click the SFC script and click the "New action" button.
171199

172200
![Creating new action](assets/newAction.png)
173201

174202
#### SFC Program
203+
175204
You have blocks available by right-clicking inside the canvas or on the top bar, you can drag and drop them.
176205

177206
The SFC program has one rule which is following the order of **Step<sub>0</sub> > Transition<sub>0</sub> > Step<sub>n</sub> > Transition<sub>n</sub> > ... > Jump**
@@ -187,6 +216,7 @@ Here is a video doing that from scratch:
187216
<iframe width="100%" height="415" src="https://www.youtube.com/embed/olQooS4bX4A" title="YouTube video player" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
188217

189218
### Functional Block Diagram
219+
190220
This is similar to the SFC Programming, but in this case there is no sequential path on the program, you add blocks to do the needed work.
191221

192222
For example, adding the **Add** block will do the Add function each cycle.
@@ -200,6 +230,7 @@ Here is a video doing that from scratch:
200230
***In the previous programs, we used local variables, remember to select the program's specific variables to be watched, or you will not see any data***
201231

202232
## Conclusion
233+
203234
You have:
204235
* Created a simple counter with each language
205236
* Learned how to watch live variable's value

package-lock.json

Lines changed: 13 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"homepage": "https://github.com/arduino/docs-content#readme",
2020
"dependencies": {
21-
"@arduino/docs-arduino-cc": "^1.8.97",
21+
"@arduino/docs-arduino-cc": "^1.8.98",
2222
"gatsby": "^4.9.2"
2323
},
2424
"volta": {

0 commit comments

Comments
 (0)