This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# boot.py -- run on boot-up | |
# can run arbitrary Python, but best to keep it minimal | |
# | |
# WiPy WiFi setup, augmented code from: | |
# http://micropython.org/resources/docs/en/latest/wipy/wipy/tutorial/wlan.html#assigning-a-static-ip-address-when-booting | |
import machine | |
from network import WLAN | |
IP = '192.168.1.42' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import wipy | |
while True: | |
wipy.heartbeat(False) # disable the heartbeat | |
time.sleep_ms(100) | |
wipy.heartbeat(True) # enable the heartbeat | |
time.sleep_ms(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from machine import Pin | |
led = Pin('GP25', mode=Pin.OUT) | |
while True: | |
led(0) # turn off the heartbeat LED | |
time.sleep_ms(100) | |
led(1) # turn on the heartbeat LED | |
time.sleep_ms(100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Rotate servo over full rotational range | |
# | |
import time | |
from machine import Pin, Timer | |
# Servo specific constants | |
PULSE_MIN = 900 # in us, actually bit higher than specs indicate | |
PULSE_MAX = 2100 # in us | |
FREQUENCY = 50 # Hz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# | |
# Rotate servo over full rotational range | |
# | |
import time | |
from machine import Pin | |
from servo import Servo | |
# Configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# first argument is WiPy ip | |
lftp -u micro,python $1 << EOF | |
cd /flash | |
put main.py | |
put WiPy-servo/servo.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
# | |
# Loop through food delivery cycle | |
# | |
import time | |
from machine import Pin | |
from servo import Servo | |
led = Pin('GP25', mode=Pin.OUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
const knownTags = ['address', 'article', 'aside', 'footer', 'h1','h2','h3','h4','h5','h6', 'header', 'hgroup', 'nav', 'section', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure', 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul', 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark', 'q', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr','caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'button', 'datalist', 'fieldset', 'form', 'input', 'label', 'legend', 'meter', 'optgroup', 'option', 'output', 'progress', 'select', 'textarea' ]; | |
const notCss = knownTags.map(tag => `:not( ${ tag } )`).join(''); | |
const nodes = document.querySelectorAll(`body ${ notCss }`); | |
const nodesArray = Array.prototype.slice.call(nodes); | |
nodesArray.map( node => { | |
const outer = document.createElement('div'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example program for basic asyncio pipeline. | |
Program takes string as input and converts it to upper case. | |
For sake of simplicity missing some "features", most notably error handling is absent. | |
Errors will silenty prevent program completion in many cases. | |
""" | |
import asyncio | |
from dataclasses import dataclass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example program for asyncio pipeline with varying stage times. | |
Program takes string as input and converts it to upper case. | |
""" | |
import asyncio | |
import random | |
from dataclasses import dataclass | |
OlderNewer