Demo entry 1469196

Flask example


Submitted by anonymous on Mar 17, 2015 at 03:32
Language: Python. Code size: 544 Bytes.

import gpio
from flask import Flask, render_template, request
import smbus
import time
# User space i2c bus for PCDuino is 2
bus = smbus.SMBus (2)
# This is the address we setup in the Arduino Program
address = 0x04
app = Flask (__name__, static_url_path='')
def index ( ):
   return render_template ('index.html', name=None)
@app.route ("/forward")
def forward ( ):
   print "Forward"
   writeCmd (3)
   # sleep one second
   time.sleep (1)
   return "ok" # keep flask happy with a return.

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).