Skip to content

Commit

Permalink
Sample updates
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianstevens committed Jan 29, 2024
1 parent 69813cd commit 352a723
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Meadow.Devices;
using Meadow.Foundation.Sensors.Temperature;
using System;
using System.Diagnostics;
using System.Threading.Tasks;

namespace Sensors.Temperature.Pct2075_Sample;
Expand All @@ -17,20 +16,21 @@ public override Task Initialize()
sensor = new Pct2075(Device.CreateI2cBus());

sensor.Updated += OnUpdated;

return Task.CompletedTask;
}

public override Task Run()
{
sensor.StartUpdating(TimeSpan.FromSeconds(1));

return base.Initialize();
return Task.CompletedTask;
}

private void OnUpdated(object sender, IChangeResult<Meadow.Units.Temperature> e)
{
Debug.WriteLine($"Temp: {e.New.Celsius:n1}C {e.New.Fahrenheit:n1}F");
Resolver.Log.Info($"Temp: {e.New.Celsius:n1}C {e.New.Fahrenheit:n1}F");
}

//<!=SNOP=>

public static async Task Main(string[] args)
{
await MeadowOS.Start(args);
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation</RepositoryUrl>
<Company>Wilderness Labs, Inc</Company>
<Authors>Wilderness Labs, Inc</Authors>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetFramework>net7</TargetFramework>
<OutputType>Exe</OutputType>
<AssemblyName>App</AssemblyName>
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\Meadow.Core\source\implementations\f7\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\Sensors.Temperature.Pct2075.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="meadow.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
<Project Sdk="Meadow.Sdk/1.1.0">
<PropertyGroup>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.Foundation</RepositoryUrl>
<Company>Wilderness Labs, Inc</Company>
<Authors>Wilderness Labs, Inc</Authors>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetFramework>netstandard2.1</TargetFramework>
<OutputType>Library</OutputType>
<AssemblyName>App</AssemblyName>
<LangVersion>10.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\..\Meadow.Core\Source\implementations\f7\Meadow.F7\Meadow.F7.csproj" />
<ProjectReference Include="..\..\Driver\Sensors.Temperature.Pct2075.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="meadow.config.yaml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

0 comments on commit 352a723

Please sign in to comment.