Skip to content

Instantly share code, notes, and snippets.

@tgfuellner
tgfuellner / serve.py
Created May 26, 2016 08:54
Who has to serve in Table Tennis
def toServe(playerTuple, sumOfPoints, game):
"""
The first player in arg playerTuple started serving
sumOfPoints of the current game
first game is 1
"""
if sumOfPoints < 20:
# First player if even
player = int(sumOfPoints / 2) % 2
@tgfuellner
tgfuellner / oled.c
Last active May 26, 2016 07:53
Oled mit ESP8266 Wemos D1 mini
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Fonts/FreeSans24pt7b.h>
// No IO Pin for Reset nedded, if oled Res 100nF to ground and 10k to 3.3V
#define OLED_RESET -1
Adafruit_SSD1306 display(OLED_RESET);
@tgfuellner
tgfuellner / oled.py
Created May 26, 2016 07:29
Oled with micropython on wemos d1 mini
import ssd1306
from machine import I2C, Pin
i2c = I2C(sda=Pin(4), scl=Pin(5))
display = ssd1306.SSD1306_I2C(64, i2c)
display.fill(0)
display.text('Hallo',20,20)
display.show()