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/arduino-cloud/04.cloud-editor/embedding-create-iframes/embedding-create-iframes.md
+57-23
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,26 @@
1
1
---
2
-
title: 'Embedding your sketches into an HTML page'
3
-
description: 'Learn about different methods when embedding your sketches in a website.'
4
-
author: 'Karl Söderby'
2
+
title: 'Embed & Share Sketches'
3
+
description: 'Learn about sharing your sketches and different methods to embed your sketches in a website.'
4
+
author: 'Karl Söderby, Hannes Siebeneicher'
5
5
---
6
6
7
7
The Cloud Editor is a great tool for creating and uploading programs while also collecting all of your sketches in one place. Another great feature is embedding them as iframes, such as articles, blogposts or journals.
8
8
9
-
To embed an iframe is very easy, and we just need to copy and paste a link from our sketch in the Cloud Editor. But we can also do a series of modifications to that iframe, and in this tutorial we will take a look at how to do that.
9
+
Embedding an iframe is easy. Simply copy and paste the link from your sketch in the Cloud Editor. But we can also do a series of modifications to that iframe, and in this tutorial we will take a look at how to do that.
10
10
11
11
## Let's start
12
12
13
-
First of all, we need to navigate to the [Cloud Editor](https://create.arduino.cc/editor). If we do not have an account, we can register one with just a few simple steps.
13
+
First of all, we need to navigate to the [Cloud Editor](https://app.arduino.cc/sketches). If we do not have an account, we can register one with just a few simple steps.
14
14
15
15
Then, we need to have a code. In this tutorial, we are just going to use the good old **blink** example. When we have our sketch ready, click on the **share** button next to the serial monitor tool. This will open up a new window, that will have two fields: **link** and **embed**. Copy the embed field.
This iframe can now simply be embedded in a HTML page, and it will look like this:
@@ -32,44 +33,73 @@ But there are many ways we can modify the iframe to look different. So let's tak
32
33
33
34
First up is the easiest: making a simple snippet. This removes the other information, such as sketch name and author, and simply presents a good looking snippet!
34
35
35
-
To do this, we just need to add the following code to the end of the URL:
36
+
To do this, we need to change `view-mode=` from `embed` to`snippet` at the end of the URL:
You can highlight as many lines as you want, and it is easily configurable. For example, if we want to highlight line 1, 3 and 5-8, we simply need to add the following to the URL:
69
+
You can highlight as many lines as you want, and it is easily configurable. For example, if we want to highlight line 4 and 6-9, we simply need to add the following to the URL:
70
70
71
71
```
72
-
&snippet#L1,L3,L5-L8
72
+
&highlight=L4,L6-L9
73
+
```
74
+
75
+
## Scope
76
+
77
+
It's also possible to only show specific lines by adding the `scope` parameter, like this:
And then using the class `arduino-sketch-iframe` in your HTML element.
133
+
And then using the class `arduino-sketch-iframe` in your `HTML element`.
134
+
135
+
## Share your Code
136
+
137
+
If you want to share you're code with others can you do so by following the same steps as above, but instead of clicking on "Embed in HTML code:" you click on "Link to share:"
104
138
105
-
## Summary
139
+

106
140
107
-
There are several cool ways of working with iframes from the Cloud Editor, and it is a really easy process that requires very little coding.
141
+
This link will direct others to a preview of our code where they can copy it or directly add it to their sketchbook.
108
142
109
-
The Cloud Editor helps you keep track on all of your sketches, and with the iframes, including your projects on other pages has never been easier.
143
+
***Note: If you want to learn how to keep sensitive data in your code safe, read [Store Sensitive Data in Sketches](/arduino-cloud/cloud-editor/share-your-sketches/).***
0 commit comments