This file contains hidden or 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
# ternary-math-test.py | |
# Simulation program for ternary gates | |
# | |
# Copyright (C) 2023, Juha-Pekka Varjonen | |
# | |
# | |
# Internet is full of wrong and badly incorrect information about ternary operations. | |
# This simple program simulates NOT, NAND and NOR gates in all their states. |
This file contains hidden or 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
/* A tiny BASIC interpreter */ | |
// heavily modified from: | |
// https://gist.github.com/pmachapman/661f0fff9814231fde48 | |
// | |
// Now it works with doubles instead of ints. Also fixed some bugs. | |
#include <string.h> | |
#include <stdio.h> | |
#include <setjmp.h> |
This file contains hidden or 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
# PI calculator | |
# | |
# - Optimized for 8-bit microcontroller | |
# - To be translated to C-language | |
# - Tested up to 500 digits | |
# | |
# Original S function taken from | |
# http://pythonfiddle.com/bailey-borwein-plouffe-formula/ | |
# Heavily modified afterwards |
This file contains hidden or 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
# converts SVF ascii files to XSVF binary file format | |
# usage: python svf2xsvf.py source.svf dest.xsvf | |
import sys | |
data = ["XCOMPLETE","XTDOMASK","XSIR","XSDR","XRUNTEST","","","XREPEAT",\ | |
"XSDRSIZE","XSDRTDO","XSETSDRMASKS","XSDRINC","XSDRB","XSDRC","XSDRE",\ | |
"XSDRTDOB","XSDRTDOC","XSDRTDOE","XSTATE","XENDIR","XENDDR",\ | |
"XSIR2","XCOMMENT","XWAIT"] |
This file contains hidden or 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 hexdump | |
import serial | |
import struct | |
def decode_addr(data, cursor): | |
(a1, a2, a3, a4, a5, a6, a7) = struct.unpack("<BBBBBBB", data[cursor:cursor+7]) | |
hrr = a7 >> 5 | |
ssid = (a7 >> 1) & 0xf | |
ext = a7 & 0x1 |