# Labs

## Services Labs

## Lab: Dweet

```bash
root@edison:~# nano maindweet.py
```

```python
#!/usr/bin/python

import dweepy
import time

def functionServicesDweet():
    while True:
        time.sleep(5)
        dweepy.dweet_for('InternetOfThings101Dweet', {'Status':'1'})
        print dweepy.get_latest_dweet_for('InternetOfThings101Dweet')
        time.sleep(5)
        dweepy.dweet_for('InternetOfThings101Dweet', {'Status':'0'})
        print dweepy.get_latest_dweet_for('InternetOfThings101Dweet')

if __name__ == '__main__':

    functionServicesDweet()

# End of File
```

```bash
root@edison:~# python maindweet.py
[{u'content': {u'Status': 0}, u'thing': u'InternetOfThings101Dweet', u'created': u'2016-05-01T16:03:10]
[{u'content': {u'Status': 1}, u'thing': u'InternetOfThings101Dweet', u'created': u'2016-05-01T16:04:06]
[{u'content': {u'Status': 0}, u'thing': u'InternetOfThings101Dweet', u'created': u'2016-05-01T16:04:12]
[{u'content': {u'Status': 1}, u'thing': u'InternetOfThings101Dweet', u'created': u'2016-05-01T16:04:19]
^Z
[8]+  Stopped(SIGTSTP)        python maindweet.py
```

## Lab: Freeboard.Io

Dashboard Creation

1. Go to [freeboard.io](https://freeboard.io/) and sign up
2. Go to [freeboard.io account](https://freeboard.io/account/), under "My Freeboards"
   * "**Enter a Name**" and "**Create New**", let's call it IoT101
   * You should see "**IoT101**" board created being a "**Public**" dashboard
3. Click on "**IoT101**" to open the dashboard

DataSource Selection

1. Once you are in "**IoT101**" Dashboard click on "**Add**" from "**DataSources**"
2. Select "**Dweet.io**" as "**Type**"
3. Choose a "**Name**" for the DataSource, e.g. "**MyIoT101Source**"
4. Type the "**Thing Name**" based on what you are sending to dweet.io e.g. "**InternetOfThings101Dweet**"

Pane/Widget Creation and DataSource Linkage

1. Select "**Add Pane**"
2. Select a type of Widget "**Sparkline**"
3. Click on "**DataSource**" and select \["Internet of Things 101"]\["Status"]
