![Overview image][overview]
The architecture is based on message passing via websockets.
On the Raspberry PI, three different TCP servers are running:
- A web-server, for serving the static web content index.html and client.js.
| Loosely ordered by necessity to me | |
| ================================== | |
| ColorSublime (to browse online schemes) | |
| Schemr (to quickly switch scheme using Alt+F5) | |
| Themr (to install and switch theme) | |
| SublimeLinter | |
| SublimeLinter-flake8 (obs! kräver att flake8 pip package är tillgängligt vid subl-start) | |
| SublimeAStyleFormatter (to properly format C++ code) | |
| Color Highlighter (to visually see #RRGGBB colors in web code) |
| 1. Install nodejs. https://nodejs.org/en/ | |
| 2. Check npm (node package manager) is installed via command prompt: | |
| $ npm | |
| 3. Install gulp: | |
| $ npm install gulp --global | |
| 4. In relevant project folder, create 'gulpfile.js': |
| # coding: utf-8 | |
| def ask(s): | |
| print("Duck: " + s) | |
| input("You: ") | |
| print("") | |
| def rubberduck(): | |
| print(""" | |
| ,-. |
| <html> | |
| <header> | |
| <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
| <body> | |
| <h1 id='name'></h1> | |
| <button onClick='window.location.reload()'> | |
| Nytt | |
| </button> |
| #!/usr/bin/env python | |
| import pygtk | |
| pygtk.require('2.0') | |
| import gtk | |
| import gobject | |
| BOOKING_MINUTES = 60 | |
| import Queue | |
| import logging | |
| logging.basicConfig( | |
| format='%(funcName)s: %(message)s', | |
| level=logging.DEBUG | |
| ) | |
| class MachineRunner(object): | |
| def __init__(self): |
| class MachineRunner(object): | |
| """Simple quantuum programming inspired finite state machine runner""" | |
| def add_machine(self, machine): | |
| self.signal_queue = Queue.Queue() # good for concurrent/threade op! | |
| self.machines.append(machine) | |
| def tick(self): | |
| while self.signal_queue.has_items(): | |
| sig = self.signal_queue.pop() |
| <h1>jQuery demo</h1> | |
| <div id="theDiv"> | |
| Detta är en liten text. | |
| </div> | |
| <input id="theButton" type="button" value="Klicka mig!" /> | |
| <script type="text/javascript"> | |
| $(document).ready(function () { |
| import Image | |
| block = 7 | |
| img = Image.open('cutup.png') | |
| w, h = img.size | |
| print 'Image (w,h)=(%d,%d)' % (w,h) | |
| ws, hs = w/float(block), h/float(block) | |
| print 'Sub image (w,h)=(%d,%d)' % (ws, hs) |