Code Monkey home page Code Monkey logo

ohm's Introduction

ohm

A resistor color code calculator written in Rust.

A simple application to compute the resistance based on a resistor's sequence of color bands. This program supports resistors displaying 3, 4, 5, or 6 bands.

Entering the sequence of colors on the resistor will display the interpreted resistor and its computed resistance in Ohms (including minimum and maximum tolerance values).

$ ohm n k r d --no-color

Identification: -[brown,black,red  gold ]-
Resistance: 1000.0 Ω ± 5.0% (min: 950.0 Ω, max: 1050.0 Ω)

The latest binaries are available as workflow artifacts for Windows, Mac, and Linux here.

Interface

A resistor color code calculator.

Usage:
    ohm [options] <band>...

Arguments:
    <band>...       colors from left to right (expects between 3 and 6)  

Options:
    --help, -h      print quick help text
    --no-color      disable color formatting
    --list          print the possible color codes

Supported Color Codes

Color Codes:
    k   black       0
    n   brown       1
    r   red         2
    o   orange      3
    y   yellow      4
    g   green       5
    b   blue        6
    v   violet      7
    a   gray        8
    w   white       9
    d   gold
    s   silver

References

[1] https://www.codrey.com/tools/resistor-color-code-calculator/

ohm's People

Contributors

cdotrus avatar

Stargazers

Benjamin Wheeler avatar

Watchers

 avatar

ohm's Issues

Typing band colors in reverse causes issues

Cool project! I typed some band colors in backwards, just for fun.

ohm on  trunk is 📦 v1.0.0 via 🦀 v1.69.0 
❯ ./target/release/ohm brown black red gold
Identification: -[┃┃┃  ┃ ]-
Resistance: 1000.0 Ω ± 5.0% (min: 950.0 Ω, max: 1050.0 Ω)

ohm on  trunk is 📦 v1.0.0 via 🦀 v1.69.0 
❯ ./target/release/ohm gold red black brown
error: band Gold is not allowed as a digit

Technically, it's the same resistor. While I understand that intuitively I should know that gold is a tolerance value and therefore should come last, beginners may not realize this. Would it be possible to check the reverse before erroring out? Perhaps printing a message like "Hint: You got it backwards" for educational purposes?

Great little project! Way easier than looking up yet another website, so I'm definitely adding this to my toolbox. 🤠

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.