Public
Edited
Jul 30, 2024
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ivr = function (v, r) {
// convenience function for deriving current from voltage and resistance
return v / r;
}
Insert cell
Insert cell
Insert cell
digitsToSegments = [6, 2, 5, 5, 4, 5, 5, 3, 7, 5]
Insert cell
expectedTotalCurrent = digitsToSegments
.map((d) => (d * currentPerSegmentInMilliAmps) / 16)
.reduce((p, c) => p + c)
Insert cell
selectedCurrent = {
if (typeof selectedDigit == "number") {
return (
digitsToSegments[selectedDigit] *
currentPerSegmentInMilliAmps *
numberOfDigits
);
} else {
return expectedTotalCurrent * numberOfDigits;
}
}
Insert cell
expectedBatteryLife = batterymAh / selectedCurrent
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sum4 = function (x) {
return osc1(x) + osc2(x) + osc3(x) + osc4(x);
}
Insert cell
osc1 = function (x) {
return Math.sin(x * freq1) > 0 ? 1 : 0;
}
Insert cell
osc2 = function (x) {
return Math.sin(x * freq2) > 0 ? 2 : 0;
}
Insert cell
osc3 = function (x) {
return Math.sin(x * freq3) > 0 ? 4 : 0;
}
Insert cell
osc4 = function (x) {
return Math.sin(x * freq4) > 0 ? 8 : 0;
}
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more