Blinking LED prototype with wapp

This example to control a LED requires a Raspberry Pi, breadboard, some wires and a LED, and a computer with an Internet connection. The steps here will show you all of the essential features of working with the Seluxit IoT Platform in Wappsto. It should take you about a half an hour to complete.

Here are all the steps you need to cover

Before we start here are all of the parts we will use in this guide

  • 1x Raspberry Pi 3, Model B, 1GB RAM
  • 1x Resistor (220)
  • 1x LED
  • 2x Female-to-Male Dupont Wire
  • 1x Breadboard
LED Hello World parts

1. Create an account in Wappsto

Go to, register and log in.

It's free up to generous usage limits [pricing]

Create Wappsto Account

2. Install and open "Seluxit IoT Creator" wapp

Click the Store in the menu on the left side. In Store, find the "Seluxit IoT Creator" wapp and install it.
Click "Open last installed" button.

Installing IoT Creator

3. Create an IoT model

Here is the IoT Model we will have in this guide and the steps we will go through to create it.
We will describe each step below.


Please note that if you create your own names, you will have to change the code examples in this tutorial accordingly, so watch out for that!

Creating IoT Model
3.1 Create a "Network"

You will now create a so-called Network in Wappsto. We are calling ours "Light" in this example.

Creating a Network
3.2 Create a "Device"

Click on the network you have just created, then click the "Add device" to create the device.
We're calling our device "Bulb". Please use caution about naming.
When you create a device, you'll be prompted to fill out a form. Answer the questions meaningfully, as it makes sense to you. But don't sweat the small stuff - this is just a hello world after all. In the image below we have used examples for each field.

Creating a Device
3.3 Create a "Value"

In this case, our "Bulb" device only has one value - "on" or "off" / "1" or "0".
To create a "Value", expand "Bulb" panel and click "Add value".
In this tutorial, we're calling our Value "LED". Please note the caution with naming mentioned in previous steps.
Here it is important that you fill out following form fields correctly to make a working example.

  • Set the "type" to "light".
  • Set "Permission" to "Read/write" so that we can control our Bulb.
  • Set "Data type" to "number".
  • The "Min value" should be set to "0" and "Max value" to "1".
  • The "Step size" should be set to "1".
  • Set the "initial value" to "0".
Create a Value
3.4 Download Python Code

When you've finished modeling your Network > Device > Value, click download and save the zip-file containing the certificates, example values, generics as well as a JSON file. Experienced programmers will recognize here that you could write a program in any given programming language on any device that supports these certificates to connect to the Seluxit IoT Platform.

Download Python code

4. Wire up your Pi and LED

Connect the wires and components as shown below. It is important that you place the LED correctly, as otherwise it will not light up. The "long leg" should be placed at the red wire, in this example connected to pin 11 (GPIO17).

Wire up Pi to LED

5. Upload files

We are using WinSCP to upload the code in this example. Connect to your Pi. Extract the downloaded folder and move it to the Pi as shown.


This description is written for Windows users, if you are using Linux or Mac you can use a terminal to do ssh and scp, instead of using Winscp and Putty.

Upload files

6. Edit python code

You can test the connection (see section 8 in this guide) by monitoring the text output in a console, but to get the led to work you will need to modify the "".

Before you continue, please ensure that you have these 2 parts installed:

sudo apt-get install rpi.gpio
sudo pip3 install wappsto

This link contains the 3 chunks of code you must copy into "".

Edit python code
  • The first part (line 2-7) have to be in the top part of the file.
  • The second part (line 12-25) have to replace the "def value_callback" function already there.
  • The third part (line 30-33) must replace the "for device in service.instance.device_list:"-loop

7. Connect to the Pi.

Now we will connect to the Raspberry Pi using PuTTY. After you log in and start the command line type "cd" and the name of your folder to enter it.
Tip: you can start writing the directory name and press "Tab" to autocomplete.
Once you have entered the directory type in the code:

sudo python3

Now the IOT model/Pi is connected to Wappsto.

Connect Pi

8. Test connection in Wappsto dashboard

Go to the pre-installed wapp, "My Data", and locate the Network that you've just added to Wappsto and the "Bulb" device with the "LED" value. Navigate to value and toggle the on/off switch. Your LED should respond.

Test connection in Wappsto

9. Create a New Wapp

Under the menu point "Installed Apps" find the "Wapp Creator" wapp which will open in a new tab. Click create new and give the wapp a name, e.g. "LED wapp".

Create a Wapp
9.1. Create a file structure for your Wapp

In "Wapp Creator", hover on newly created wapp and click "Edit code". You'll have a blank canvas now. What you need to add is 3 files with the following names and code. After you create files and copy paste the code, press "Save" and you will see the UI loading in the canvas on the right side.

Once you save this code a popup will be prompted asking you to accept the permission to control your LED. This is required because by default wapps are not allowed to retrieve any user data. Accept it and try switching your LED "on" and "off" using the buttons in your wapp. (Blinking part is handled in the next step).

Create file structure for Wapp
9.2. Create and code automated task (blinking)

Create the following files under the "Background" section the same way you did in the "Foreground" and press "Save".

All the background tasks are constantly running in the cloud. To stop it from running, you can uninstall the wapp or remove the code.

Create blinking task

10. Run your new wapp

Once you have Saved your files in the "Background" you can go back to the "Foreground" and press "Reload". Try turning your LED "on","off" or to "blink" or "stop blinking", your LED should respond.
How can flashing a LED still be so satisfying?

This is just the beginning!

Try to make you own modifications, and play around.

Run Wapp

Please make sure you shut down the Raspberry Pi before unplugging the power cable!

11. Shutdown

To shut down the Pi, in PuTTY command prompt stop the program by using the keybord command "Ctr+c" twice.
Then enter the following command:

sudo shutdown -h now

The small green light on your Pi should stop blinking, meaning its safe to unplug.

Shutdown Pi