-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a125f31
commit fac7e1a
Showing
5 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Documentation.playground/Pages/Conversion Functions.xcplaygroundpage/Contents.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//: [Banded Resistor Conversion Inits](@previous) | ||
import Resistance | ||
/*: | ||
# Conversion Functions | ||
|
||
The `BandedResistor` types all provide functions for converting to and from each other. | ||
The newly created resistor will have the same `tolerance` value as the resistor it was | ||
converted from. | ||
*/ | ||
let fourBand = FourBandResistor(value: 3300, tolerance: .green) | ||
let fiveBand = fourBand.convertToFiveBand() | ||
|
||
let greenTolerance = fiveBand.tolerance | ||
/* | ||
When converting to a `SixBandResistor` you can specify a temperature coefficient value | ||
to add to the newly created resistor or a default of `.brown` will be used. | ||
*/ | ||
let sixBandDefaultTempCo = fiveBand.convertToSixBand() | ||
let sixBandNewTempCo = fourBand.convertToSixBand(addingCoefficient: .yellow) | ||
|
||
let brownTempCo = sixBandDefaultTempCo.coefficient | ||
let yellowTempCo = sixBandNewTempCo.coefficient | ||
//: [ESeriesProtocol](@next) |
2 changes: 1 addition & 1 deletion
2
Documentation.playground/Pages/ESeriesProtocol.xcplaygroundpage/Contents.swift
This file contains 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
This file contains 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
This file contains 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
This file contains 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