view py/gpio_test.py @ 230:185621f47040

run 2to3
author Matt Johnston <matt@ucc.asn.au>
date Fri, 10 Apr 2015 23:59:16 +0800
parents d9e81a563923
children e39ed85d87a5
line wrap: on
line source

import os

from utils import L,D,EX,W

__all__ = ["Gpio"]

class Gpio(object):
	def __init__(self, pin, name):
		self.name = name
		self.pin = name
		self.state = False
		L("Test GPIO %s pin %d started, set off." % (name, pin))

	def turn(self, value):
		self.state = bool(value)
		onoff = ("off", "on")[int(self.state)]
		L("Test GPIO %s pin %d turned %s" % (self.name, self.pin, onoff))

	def get_state(self):
		return self.state