A Javascript Library to compute arbitrary resistor values from a set of given resistors. Supports drawing to SVG.
Go to file
2020-11-18 18:01:42 +01:00
imgs Export Symbols 2020-11-18 17:54:39 +01:00
modules Export Symbols 2020-11-18 17:54:39 +01:00
index.html Refactor codebase 2020-11-18 17:31:31 +01:00
main.js Export Symbols 2020-11-18 17:54:39 +01:00
README.md Update 'README.md' 2020-11-18 18:01:42 +01:00

ResistorJS

ResistorJS is a Javascript library intended to compose electronical resistors.

Using Resistors in Code

In order to instantiate an 100 Ohm resistor, we simply call new Resistor(100). In order to compose several resistors, the composite resistor types SeriesResistor and ParallelResistor are available.

var r1 = new Resistor(100);
var r2 = new Resistor(150);
// Combining resistors
var inSeries = r1.series(r2); // type: SeriesResistor
var inParallel = r1.parallel(r2); // type: ParallelResistor

inSeries.getOhmage() // 250
inParallel.getOhmage() // 60

// Drawing to DOM
r1.draw(div1);
r2.draw(div2);
inSeries.draw(div3);
inParallel.draw(div4);

Calling Resistor.draw(element) generates an SVG from the constructed Resistor object. Above code would render something like this: Your browser cannot display images :(