IoT Actuator Hello World

What you will learn in this tutorial:

Preconditions

After connecting your Raspberry Pi:

you can follow this tutorial.

Hardware setup

In this exercise we are going to use pin #7 as an output (actuator) to control the green LED

Raspberry Pi 1 Rev 1 Pinout reference here

Raspberry Pi 1 Rev 2 Pinout reference here

Raspberry Pi 2/3 Pinout reference here

Raspberry Pi zero w Pinout reference here

Let’s use Iottly to configure a command to remotely control the LED

Message Setup

Create the following message:

Alt text

Iottly Code

Edit the following snippets in the “Management Scripts” panel:

def init():
  #...

  #-----------------------------------------------------------------------------#

  # here your code!!

  pin = "7"
  GPIO.setup(int(pin), GPIO.OUT)

  #-----------------------------------------------------------------------------#

def LED_control(command):
  #...
  cmdpars = command["LED_control"]
  #...
  #-----------------------------------------------------------------------------#

  # here your code!!
  state = {
    'on': True,
    'off': False
  }.get(cmdpars['state'], False)  
  GPIO.output(7,state)
  #-----------------------------------------------------------------------------#