Devesh36/bench-eight

Eight-channel 0–10 V measurement and control console: dual ADS1115 ADCs, buffered inputs, Pico controller, microSD, RTC, RS-485, four protected low-voltage outputs and a separate OLED/encoder panel in a tscircuit assembly.

Version
0.1.3
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone Devesh36/bench-eight  # download the package files into ./bench-eight
tsci add Devesh36/bench-eight    # add it to your project as @tsci/Devesh36.bench-eight

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

lettering.tsx

import { jscad } from "tscircuit";
const font: Record<string, string[]> = {
	C: ["01111", "10000", "10000", "10000", "10000", "10000", "01111"],
	D: ["11110", "10001", "10001", "10001", "10001", "10001", "11110"],
	L: ["10000", "10000", "10000", "10000", "10000", "10000", "11111"],
	U: ["10001", "10001", "10001", "10001", "10001", "10001", "01110"],
	V: ["10001", "10001", "10001", "10001", "01010", "01010", "00100"],
	"0": ["01110", "10001", "10011", "10101", "11001", "10001", "01110"],
	"1": ["00100", "01100", "00100", "00100", "00100", "00100", "01110"],
	"2": ["01110", "10001", "00001", "00010", "00100", "01000", "11111"],
	"3": ["11110", "00001", "00001", "01110", "00001", "00001", "11110"],
	"4": ["00010", "00110", "01010", "10010", "11111", "00010", "00010"],
	"5": ["11111", "10000", "10000", "11110", "00001", "00001", "11110"],
	"6": ["01110", "10000", "10000", "11110", "10001", "10001", "01110"],
	"7": ["11111", "00001", "00010", "00100", "01000", "01000", "01000"],
	"8": ["01110", "10001", "10001", "01110", "10001", "10001", "01110"],
	"9": ["01110", "10001", "10001", "01111", "00001", "00001", "01110"],

	A: ["01110", "10001", "10001", "11111", "10001", "10001", "10001"],
	B: ["11110", "10001", "10001", "11110", "10001", "10001", "11110"],
	E: ["11111", "10000", "10000", "11110", "10000", "10000", "11111"],
	H: ["10001", "10001", "10001", "11111", "10001", "10001", "10001"],
	I: ["11111", "00100", "00100", "00100", "00100", "00100", "11111"],
	N: ["10001", "11001", "10101", "10011", "10001", "10001", "10001"],
	Q: ["01110", "10001", "10001", "10001", "10101", "10010", "01101"],
	R: ["11110", "10001", "10001", "11110", "10100", "10010", "10001"],
	S: ["01111", "10000", "10000", "01110", "00001", "00001", "11110"],
	T: ["11111", "00100", "00100", "00100", "00100", "00100", "00100"],
	G: ["01110", "10001", "10000", "10111", "10001", "10001", "01110"],
	c: ["00000", "00000", "01111", "10000", "10000", "10000", "01111"],
	i: ["00100", "00000", "01100", "00100", "00100", "00100", "01110"],
	r: ["00000", "00000", "10110", "11001", "10000", "10000", "10000"],
	s: ["00000", "00000", "01111", "10000", "01110", "00001", "11110"],
	t: ["00100", "00100", "11111", "00100", "00100", "00100", "00011"],
	u: ["00000", "00000", "10001", "10001", "10001", "10011", "01101"],
	O: ["01110", "10001", "10001", "10001", "10001", "10001", "01110"],
	F: ["11111", "10000", "10000", "11110", "10000", "10000", "10000"],

	"-": ["00000", "00000", "00000", "11111", "00000", "00000", "00000"],
	" ": Array(7).fill("00000"),
};
export function PixelText({
	text,
	x,
	y,
	z,
	pitch = 0.24,
}: { text: string; x: number; y: number; z: number; pitch?: number }) {
	return (
		<jscad.union>
			{text
				.split("")
				.flatMap((c, i) =>
					(font[c] ?? font[" "]).flatMap((row, j) =>
						row
							.split("")
							.flatMap((bit, k) =>
								bit === "1"
									? [
											<jscad.cuboid
												key={`${i}:${j}:${k}`}
												size={[pitch * 0.88, pitch * 0.88, 0.035]}
												center={[x + (i * 6 + k) * pitch, y - j * pitch, z]}
											/>,
										]
									: [],
							),
					),
				)}
		</jscad.union>
	);
}