From dd70a057baf4c19f3b5311dea7129e2ec3c52ca5 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Fri, 3 Jan 2025 17:36:06 -0800 Subject: [PATCH] Readme update --- .../Sensors.Flow.HallEffect/Driver/Readme.md | 56 ++----------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/Source/Meadow.Foundation.Peripherals/Sensors.Flow.HallEffect/Driver/Readme.md b/Source/Meadow.Foundation.Peripherals/Sensors.Flow.HallEffect/Driver/Readme.md index 86e449b921..3d1e80b6cd 100644 --- a/Source/Meadow.Foundation.Peripherals/Sensors.Flow.HallEffect/Driver/Readme.md +++ b/Source/Meadow.Foundation.Peripherals/Sensors.Flow.HallEffect/Driver/Readme.md @@ -1,8 +1,8 @@ -# Meadow.Foundation.Sensors.Light.Bh1750 +# Meadow.Foundation.Sensors.Flow.HallEffect -**Bh1750 I2C luminance and color light sensor** +**Drivers for various hall effect flow sensor** -The **Bh1750** library is included in the **Meadow.Foundation.Sensors.Light.Bh1750** nuget package and is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform. +The **HallEffectFlowSensors** library is included in the **Meadow.Foundation.Sensors.Flow.HallEffect** nuget package and is designed for the [Wilderness Labs](www.wildernesslabs.co) Meadow .NET IoT platform. This driver is part of the [Meadow.Foundation](https://developer.wildernesslabs.co/Meadow/Meadow.Foundation/) peripherals library, an open-source repository of drivers and libraries that streamline and simplify adding hardware to your C# .NET Meadow IoT applications. @@ -14,55 +14,7 @@ To view all Wilderness Labs open-source projects, including samples, visit [gith You can install the library from within Visual studio using the the NuGet Package Manager or from the command line using the .NET CLI: -`dotnet add package Meadow.Foundation.Sensors.Light.Bh1750` -## Usage - -```csharp -Bh1750 sensor; - -public override Task Initialize() -{ - Resolver.Log.Info("Initialize..."); - - var i2c = Device.CreateI2cBus(); - sensor = new Bh1750( - i2c, - measuringMode: Mode.ContinuouslyHighResolutionMode, // the various modes take differing amounts of time. - lightTransmittance: 1 // lower this to increase sensitivity, for instance, if it's behind a semi opaque window - ); - - // Example that uses an IObservable subscription to only be notified when the filter is satisfied - var consumer = Bh1750.CreateObserver( - handler: result => Resolver.Log.Info($"Observer: filter satisfied: {result.New.Lux:N2}Lux, old: {result.Old?.Lux:N2}Lux"), - - // only notify if the visible light changes by 100 lux (put your hand over the sensor to trigger) - filter: result => - { - if (result.Old is { } old) - { - // returns true if > 100lux change - return ((result.New - old).Abs().Lux > 100); - } - return false; - }); - sensor.Subscribe(consumer); - - // classical .NET events can also be used: - sensor.Updated += (sender, result) => Resolver.Log.Info($"Light: {result.New.Lux:N2}Lux"); - - return Task.CompletedTask; -} - -public override async Task Run() -{ - var result = await sensor.Read(); - Resolver.Log.Info("Initial Readings:"); - Resolver.Log.Info($" Light: {result.Lux:N2}Lux"); - - sensor.StartUpdating(TimeSpan.FromSeconds(1)); -} - -``` +`dotnet add package Meadow.Foundation.Sensors.Flow.HallEffect` ## How to Contribute - **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues)