Update 'README.md'

This commit is contained in:
dominic 2020-11-18 18:01:42 +01:00
parent 32e10a3cf4
commit 7364b2c4c5

View File

@ -3,13 +3,16 @@ 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.
```
```JS
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);