{"id":20989837,"url":"https://github.com/robtillaart/weight","last_synced_at":"2025-05-14T18:32:13.465Z","repository":{"id":45233518,"uuid":"272975357","full_name":"RobTillaart/weight","owner":"RobTillaart","description":"Library of weight conversion functions","archived":false,"fork":false,"pushed_at":"2024-04-13T09:18:10.000Z","size":37,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-07T18:27:16.687Z","etag":null,"topics":["arduino","kg","lbs","stone","weight"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"RobTillaart"}},"created_at":"2020-06-17T13:02:19.000Z","updated_at":"2023-10-13T20:19:55.000Z","dependencies_parsed_at":"2023-11-23T15:26:23.722Z","dependency_job_id":"917bf80f-cc62-4ce3-8d48-244282b1b328","html_url":"https://github.com/RobTillaart/weight","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Fweight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Fweight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Fweight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2Fweight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/weight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225305713,"owners_count":17453435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","kg","lbs","stone","weight"],"created_at":"2024-11-19T06:26:22.362Z","updated_at":"2024-11-19T06:26:23.295Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/weight/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/weight/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/weight/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/weight/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/weight/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/weight.svg)](https://github.com/RobTillaart/weight/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/weight/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/weight.svg?maxAge=3600)](https://github.com/RobTillaart/weight/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/weight.svg)](https://registry.platformio.org/libraries/robtillaart/weight)\n\n\n# Weight\n\nArduino library to convert weight units.\n\n\n## Description\n\nWeight.h is a library containing weight conversion functions.\n\nOpen for additions, including obscure weight metrics or\nweight related math functions and constants.\n\n\n#### Overview of conversions:\n\n```\n          stone - lbs - ounce\n            |      |      |\n           kilo   kilo - gram\n\n\n           kilo - (stone, lbs, ounce)\n```\n\n\n#### Related\n\n- https://github.com/RobTillaart/AtomicWeight\n- https://github.com/RobTillaart/VolumeConverter\n- https://github.com/RobTillaart/HX711\n- https://github.com/RobTillaart/HX711_MP\n\n\n## Interface\n\n```cpp\n#include \"weight.h\"\n```\n\nFunctions are straightforward.\n\n- **float lbs2kilo(float lbs)**\n- **float kilo2lbs(float kilos)**\n- **float ounce2gram(float ounce)**\n- **float gram2ounce(float gram)**\n- **float gram2kilo(float gram)**\n- **float kilo2gram( float kilo)**\n- **float lbs2ounce(float lbs)**\n- **float ounce2lbs(float ounce)**\n- **float stone2lbs(float stone)**\n- **float lbs2stone(float lbs)**\n- **float stone2kilo(float stone)**\n- **float kilo2stone(float kilo)**\n- **float US2metric(float stone, float lbs, float ounce)**\n- **float metric2US(float kilo, float \u0026stone, float \u0026lbs, float \u0026ounce)**\n\n\n## Operation\n\nSee examples\n\n----\n\n# weightConverter class\n\nSince version 0.2.0 a weight convertor class is added to convert to and from\nother (less known) weight scales.\nThe idea is to set a value in one scale and retrieve it in the other.\nAs the converter holds the last value set, multiple conversions of the same \nweight are easy.\n\nNew conversions are possible by providing a setXYZ and getXYZ() function.\nThese two should convert to and from grams respectively.\nAdditions are welcome, please open an issue.\n\nInternal representation is the gram as it the ISO standard.\n\nSince version 0.3.0 the converter can also add different units.\n\n\n## Interface\n\n```cpp\n#include \"weight.h\"\n```\n\n#### Constructor\n\n- **weightConverter()**\n\n#### Setters\n\n- **void setKilogram(float value = 0)** \n- **void setGram(float value = 0)** \n- **void setLBS(float value = 0)**\n- **void setStone(float value = 0)**\n- **void setOunce(float value = 0)**\n- **void setLongTonUK(float value = 0)**\n- **void setShortTonUS(float value = 0)**\n- **void setQuarterUK(float value = 0)**\n- **void setQuarterUS(float value = 0)**\n- **void setSlug(float value = 0)**\n- **void setTroyPound(float value = 0)**\n- **void setTroyOunce(float value = 0)**\n- **void setRobie(float value = 0)**\n- **void setDram(float value = 0)**\n- **void setDrachme(float value = 0)**\n- **void setPoint(float value = 0)**\n- **void setGrain(float value = 0)**\n- **void setCarat(float value = 0)**\n\n#### Adders\n\n- **void addKilogram(float value = 0)** \n- **void addGram(float value = 0)** \n- **void addLBS(float value = 0)**\n- **void addStone(float value = 0)**\n- **void addOunce(float value = 0)**\n- **void addLongTonUK(float value = 0)**\n- **void addShortTonUS(float value = 0)**\n- **void addQuarterUK(float value = 0)**\n- **void addQuarterUS(float value = 0)**\n- **void addSlug(float value = 0)**\n- **void addTroyPound(float value = 0)**\n- **void addTroyOunce(float value = 0)**\n- **void addRobie(float value = 0)**\n- **void addDram(float value = 0)**\n- **void addDrachme(float value = 0)**\n- **void addPoint(float value = 0)**\n- **void addGrain(float value = 0)**\n- **void addCarat(float value = 0)**\n\n#### Getters\n\n- **float getKilogram()**\n- **float getGram()**\n- **float getLBS()**\n- **float getStone()**\n- **float getOunce()**\n- **float getLongTonUK()**\n- **float getShortTonUS()**\n- **float getQuarterUK()**\n- **float getQuarterUS()**\n- **float getSlug()**\n- **float getTroyPound()**\n- **float getTroyOunce()**\n- **float getRobie()**\n- **float getDram()**\n- **float getDrachme()**\n- **float getPoint()**\n- **float getGrain()**\n- **float getCarat()**\n\n\n## Future\n\n#### Must\n\n- improve documentation\n  - where are units used\n\n#### Should\n\n\n#### Could\n\n- create data types of stone lbs kilo etc.?\n- should float be double?\n\n#### Won't (unless)\n\n- large masses - sun planets ?   (see relativity library)\n- gravity constants of planets REL or ABS eg REL_GRAVITY_EARTH 1.0\n- molarity functions\n- mass of common substances.\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fweight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Fweight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fweight/lists"}