WebIOPi. Installation Walk-through Macros



Similar documents
Embedded Based Web Server for CMS and Automation System

Solr Bridge Search Installation Guide

Adafruit's Raspberry Pi Lesson 6. Using SSH

How to start with 3DHOP

Partek Flow Installation Guide

MySQL quick start guide

WA2256 Responsive Mobile Web Development with HTML5, CSS3, JavaScript, and jquery Mobile. Classroom Setup Guide. Web Age Solutions Inc.

MySQL Quick Start Guide

Configuring Web services

Monitor Your Home With the Raspberry Pi B+

Creating a DUO MFA Service in AWS

Spam Marshall SpamWall Step-by-Step Installation Guide for Exchange 5.5

Installing OptiRain Open on Macintosh OS X 10.6 (Snow Leopard)

Jolly Server Getting Started Guide

Static webpages with Pelican

AdRadionet to IBM Bluemix Connectivity Quickstart User Guide

Deploying Intellicus Portal on IBM WebSphere

This document details the following four steps in setting up a Web Server (aka Internet Information Services -IIS) on Windows XP:

Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

MySQL Quick Start Guide

Using Dedicated Servers from the game

Apache JMeter HTTP(S) Test Script Recorder

tpischeduler tpischeduler TotalFBO tpischeduler TotalFBO Initial Installation tpischeduler TotalFBO tpischeduler

Running Nginx as Reverse Proxy server

Maintaining the Content Server

Extending Remote Desktop for Large Installations. Distributed Package Installs

RemoteTM Web Server User Guide. Copyright Maxprograms

14.1. bs^ir^qfkd=obcib`qflk= Ñçê=emI=rkfuI=~åÇ=léÉåsjp=eçëíë

Comparison table for an idea on features and differences between most famous statistics tools (AWStats, Analog, Webalizer,...).

Magento Search Extension TECHNICAL DOCUMENTATION

SETTING UP AND RUNNING A WEB SITE ON YOUR LENOVO STORAGE DEVICE WORKING WITH WEB SERVER TOOLS

Multi-Router Traffic Grapher (MRTG)

E-Blocks Easy Internet Bundle

DiskPulse DISK CHANGE MONITOR

IIS, FTP Server and Windows

Organizer db Browser Manual

Example. Represent this as XML

Monitoring Oracle Enterprise Performance Management System Release Deployments from Oracle Enterprise Manager 12c

VERSION 9.02 INSTALLATION GUIDE.

SysPatrol - Server Security Monitor

RPM Utility Software. User s Manual

LAMP Quickstart for Red Hat Enterprise Linux 4

8x8 Virtual Office Telephony Interface for Salesforce

Version 1.0 January Xerox Phaser 3635MFP Extensible Interface Platform

Cloud Homework instructions for AWS default instance (Red Hat based)

Expresso Quick Install

Moxa Device Manager 2.3 User s Manual

SizmekFeatures. HTML5JSSyncFeature

NaviCell Data Visualization Python API

Mapping ITS s File Server Folder to Mosaic Windows to Publish a Website

PiFace Control & Display

3DHOP Local Setup. Lezione 14 Maggio 2015

ResPAK Internet Module

École des Ponts Paristech DSI. Installing OpenVPN

Configuring MailArchiva with Insight Server

Running Knn Spark on EC2 Documentation

Practice Fusion API Client Installation Guide for Windows

MASTERTAG DEVELOPER GUIDE

Publish Acrolinx Terminology Changes via RSS

Notification messages

Local Caching Servers (LCS): User Manual

Apache 2.2 on QNX Neutrino 6.4.x OS Step-by-step installation manual

Develop a Native App (ios and Android) for a Drupal Website without Learning Objective-C or Java. Drupaldelphia 2014 By Joe Roberts

Introduction. Before you begin. Installing efax from our CD-ROM. Installing efax after downloading from the internet

Hadoop Data Warehouse Manual

FlexSim LAN License Server

INSTALLING KAAZING WEBSOCKET GATEWAY - HTML5 EDITION ON AN AMAZON EC2 CLOUD SERVER

LICENSE4J LICENSE ACTIVATION AND VALIDATION PROXY SERVER USER GUIDE

General Information. Getting Started. Curriculum Overview

Ipswitch Client Installation Guide

CPE111 COMPUTER EXPLORATION

CEFNS Web Hosting a Guide for CS212

freesshd SFTP Server on Windows

Installing and using XAMPP with NetBeans PHP

Installation Instructions

Web+Center Version 7.x Windows Quick Install Guide 2 Tech Free Version Rev March 7, 2012

Lecture 9 Chrome Extensions

Installing Virtual Coordinator (VC) in Linux Systems that use RPM (Red Hat, Fedora, CentOS) Document # 15807A1-103 Date: Aug 06, 2012

CA Spectrum and CA Service Desk

Setting up an Apache Web Server for Greenstone 2 Walkthrough

X10 Webinterface User Quick Guide(ver0.9.2 Beta)

How to install PowerChute Network Shutdown on VMware ESXi 3.5, 4.0 and 4.1

AXIOM 4 AXIOM SERVER GUIDE

Dragonframe License Manager User Guide Version 1.2.2

How to Configure edgebox as a Web Server

An Introduction To The Web File Manager

BusinessObjects Enterprise XI Release 2

Installing an open source version of MateCat

Using a Remote SQL Server Best Practices

ECE 4893: Internetwork Security Lab 12: Web Security

JW Player Quick Start Guide

Sharp Remote Device Manager (SRDM) Server Software Setup Guide

System Administration Training Guide. S100 Installation and Site Management

Web-JISIS Reference Manual

Network/Floating License Installation Instructions

IBM Script Portlet for WebSphere Portal Release 1.1

Transcription:

WebIOPi Installation Walk-through Macros

Installation Install WebIOPi on your Raspberry Pi Download the tar archive file: wget www.cs.unca.edu/~bruce/fall14/webiopi-0.7.0.tar.gz Uncompress: tar xvfz WebIOPi-0.7.0.tar.gz Change directory to new WebIO folder: cd WebIOPi-0.7.0 Run setup shell script: sudo./setup.sh

Breadboard: ground and power Setup ground and power rails

Breadboard: Add components

WebIOPi Try it: On the Pi, start the web server: sudo service webiopi start On the Pi, open the WebIOPi default page in Midori: use the URL: localhost:8000 Open the WebIOPi default page in Chrome on your PC: On your Pi, use the ifconfig command to determine your pi's IP For example, it might be: 192.168.0.146 On you PC, open Chrome and open the URL: IP:8000 For example the URL might be: 192.168.0.146:8000

What's happening All of the source code is installed on your Pi in the WebIOPi-0.7.0 directory but it's easier to view on the Source tab of the WebIOPi site WebIOPi is REST API containing many things: a HTTP server (written in python), a library of javascript library, python library... The default WebIOPi display is created using: the index.html file in the htdocs directory The GPIO configuration as defined by the files in the python directory Both the GPIO configuration and the browser display can be customized

A tour of WebIOPi: Example 1 Start with the example scripts installed in your WebIOPi folder Change directory to WebIOIPi-0.7.0/examples/scripts/simple Notice the file index.html Edit the WebIOPi config file to reference this html files: sudo gedit (or nano) /etc/webiopi/config In the [HTTP] section, change doc-root to be: doc-root=/home/pi/webiopi-0.7.0/examples/scripts/simple Stop the server: sudo service webiopi stop Restart the server: sudo service webiopi start Look at the default URL in the brower and open the index.html file to understand what's happening

Recap on building a custom HTML file Include the webiopi.js javascript library Include in-line javascript code that begins with an anonymous Javascript function passed to the WebIOPi JS library function webiopi().ready() The $( id ) returns the DOM object of the element with that id Create buttons using webiopi().creategpiobutton() Append buttons to html elements using the jquery method append() Include webiopi().refreshgpio(true) to update the display WebIOPi has predefined CSS ids and classes

Example 2 Let's look at the blink example script in your WebIOPi folder Change directory to WebIOIPi-0.7.0/examples/scripts/blink Notice the script.py file but no index.html Edit the WebIOPi config file to reference this script file and remove the reference to the previous custom index.html file: sudo gedit (or nano) /etc/webiopi/config In the [HTTP] section, comment out the doc-root assignment: #doc-root=/home/pi/webiopi-0.7.0/examples/scripts/simple In the [SCRIPTS] section, change myscript to be: myscript=/home/pi/webiopi-0.7.0/examples/scripts/blink/script.py Stop the server: sudo service webiopi stop Restart the server: sudo service webiopi start Look at the default URL in the brower and open the index.html file to understand what's happening

Recap on make custom python scripts import webiopi define GPIO = webiopi.gpio Interface with server via setup(), loop() and destory() functions setup() is run once on first load loop() is run repeatedly destroy() is run before server shutdown Can define other functions to be called within the three above

Example 3: Macros Macros are used to define custom functionality in the WebIOPi API They are functions written in python that can be referenced in the html document running in a browser---exchange information between server and browser Edit /etc/webiopi/config file to load the contents of the tutorials/2.macros directory In the [HTTP] section, make the doc-root assignment: doc-root=/home/pi/webiopi-0.7.0/tutorials/2.macros In the [SCRIPTS] section, change myscript to be: myscript=/home/pi/webiopi-0.7.0/tutorials/2.macros/script.p Stop the server: sudo service webiopi stop Restart the server: sudo service webiopi start Look at the default URL in the brower and open the index.html file to understand what's happening

Example 4, more macros Edit /etc/webiopi/config file to load the contents of the examples/scripts/macros directory In the [HTTP] section, make the doc-root assignment: doc-root=/home/pi/webiopi-0.7.0/examples/scripts/macros In the [SCRIPTS] section, change myscript to be: myscript=/home/pi/webiopi0.7.0/examples/scripts/macros/script.p Stop the server: sudo service webiopi stop Restart the server: sudo webiopi -d -c /etc/webiopi/config Look at the screen output

Recap on Macros Used to exchange information between server and browser The WebIOPi JS library function webiopi().callmacro() is useful for calling macros that return values The return values become the input to the referenced callback function Functions assigned to variables are useful for referencing callback functions Macros that return values are not useful unless used in conjunction with a callback function

Resources WebIOPi main page WebIOPi source code WebIOPi forum jquery API