def main(): webserver = WebServer(port=8888, debug=True) webserver.websocket('/slider-value', SharedValue(20, on_change=slider_updated)) webserver.static_files('/', './static') print('Listening on %s' % webserver.url) webserver.run()
def main(): webserver = WebServer(port=8888, debug=True) webserver.websocket('/volume-value', SharedValue(20, on_change=volume_updated)) webserver.websocket('/tone-value', SharedValue(20, on_change=tone_updated)) webserver.websocket('/sustain-value', SharedValue(20, on_change=sustain_updated)) webserver.static_files('/', './static') print('Listening on %s' % webserver.url) webserver.run()
def main(): try: # Specify GPIO mode GPIO.setmode(GPIO.BOARD) webserver = WebServer(port=8888, debug=True) # Open and configure SPI interface status = spi.openSPI(speed=1000000, mode=0) print "SPI configuration: ",status GPIO.setup(SPI_SEL1_PIN, GPIO.OUT) GPIO.setup(SPI_SEL2_PIN, GPIO.OUT) GPIO.setup(SPI_SEL3_PIN, GPIO.OUT) print 'GPIOs initialized' volume.change_handlers.append(volume_updated) volume.open_handlers.append(volume_open) volume.close_handlers.append(airset_close) tone.change_handlers.append(tone_updated) tone.open_handlers.append(tone_open) tone.close_handlers.append(airset_close) sustain.change_handlers.append(sustain_updated) sustain.open_handlers.append(sustain_open) sustain.close_handlers.append(airset_close) webserver.websocket('/volume-value',volume) webserver.websocket('/tone-value',tone) webserver.websocket('/sustain-value',sustain) webserver.websocket('/save-preset', SharedValue(value=read_preset(), on_change=save_preset)) webserver.websocket('/get-preset', SharedValue(on_change=get_preset)) webserver.static_files('/', './static') print('Listening on %s' % webserver.url) webserver.run() except (KeyboardInterrupt, SystemExit): print "Closing SPI..." spi.closeSPI() print "Cleaning up GPIO..." GPIO.cleanup()