first commit
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}</ProjectGuid>
|
||||
<OutputType>winmdobj</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LightSensorLCDDisplay</RootNamespace>
|
||||
<AssemblyName>LightSensorLCDDisplay</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<AllowCrossPlatformRetargeting>false</AllowCrossPlatformRetargeting>
|
||||
<PackageCertificateKeyFile>ButtonBuzzer_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<AppxPackage>true</AppxPackage>
|
||||
<ContainsStartupTask>true</ContainsStartupTask>
|
||||
<PackageCertificateThumbprint>248FBDE23D3A4D2ADF6A12A4178EB28F28C0BE1C</PackageCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
<None Include="LightSensorLCDDisplay.snk" />
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="StartupTask.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="Assets\LockScreenLogo.scale-200.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\SplashScreen.scale-200.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\StoreLogo.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png">
|
||||
<InProject>false</InProject>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GrovePi, Version=1.0.7.0, Culture=neutral, processorArchitecture=ARM">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\GrovePi\bin\ARM\Debug\GrovePi.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>LightSensorLCDDisplay.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DelaySign>false</DelaySign>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LightSensorLCDDisplay", "LightSensorLCDDisplay.csproj", "{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DC9CE5B0-5F88-4AFC-9F7A-CBCB69B6DFD7}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x64.Build.0 = Debug|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x86.Build.0 = Debug|x86
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|ARM.Build.0 = Release|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x64.ActiveCfg = Release|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x64.Build.0 = Release|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x64.Deploy.0 = Release|x64
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x86.ActiveCfg = Release|x86
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x86.Build.0 = Release|x86
|
||||
{1AAB0B0C-4AD6-49A7-9A1C-78ACE337A938}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp iot">
|
||||
<Identity Name="LightSensorLCDDisplayr-uwp" Publisher="CN=John" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="0e29ae6c-d965-4f75-9387-70a777ae7169" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>LightSensorLCDDisplay</DisplayName>
|
||||
<PublisherDisplayName>Dexter Industries</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App">
|
||||
<uap:VisualElements DisplayName="LightSensorLCDDisplay" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Demonstrate the Light Sensor and the LCD Display with the Dexter Industries GrovePi." BackgroundColor="transparent" AppListEntry="none">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<Extension Category="windows.backgroundTasks" EntryPoint="LightSensorLCDDisplay.StartupTask">
|
||||
<BackgroundTasks>
|
||||
<iot:Task Type="startup" />
|
||||
</BackgroundTasks>
|
||||
</Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("LightSensorLCDDisplay")]
|
||||
[assembly: AssemblyDescription("Demonstrates Using the Light Sensor and the LCD Display with the Dexter Industries GrovePi.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Dexter Industries")]
|
||||
[assembly: AssemblyProduct("GrovePi")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("GrovePi")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: NeutralResourcesLanguage("")]
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|
||||
87
Software/CSharp/Samples/Light_Sensor_LCDDisplay/README.md
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
## **Button and Buzzer Example**
|
||||
This example will demonstrate how to use the [Dexter Industries GrovePi](http://www.dexterindustries.com/grovepi-starter-kit/) with the [Grove Buzzer](http://www.dexterindustries.com/shop/grove-buzzer/) and the [Grove Button](http://www.dexterindustries.com/shop/grove-button/) to create a buzzer controlled by the touch sensor. This sample is designed to run on a Raspberry Pi 2 running Windows 10 IoT Core. The application is written as a Background Task and will run in Windows 10 IoT Core without any user interface.
|
||||
|
||||
### Requirements
|
||||
You must have the following:
|
||||
|
||||
- [Windows 10](https://www.microsoft.com/windows/)
|
||||
- [Visual Studio 2015 Community Edition](https://www.visualstudio.com/) or better
|
||||
- [Raspberry Pi 2 running Windows 10 IoT Core](http://ms-iot.github.io/content/en-US/win10/RPI.htm)
|
||||
- [GrovePi+ Starter Kit for Raspberry Pi](http://www.dexterindustries.com/grovepi-starter-kit/)
|
||||
|
||||
### Install a Visual Studio 2015
|
||||
If you don't already have one installed, install Visual Studio 2015. You can use the free Community edition, or any other higher edition. When you are installing Visual Studio, you must do a __Custom__ install and select to install the __Universal Windows App Development Tools -> Tools and Windows SDK__.
|
||||
|
||||
After the installation is complete, install the Windows IoT Core Project Templates from [here](https://visualstudiogallery.msdn.microsoft.com/55b357e1-a533-43ad-82a5-a88ac4b01dec).
|
||||
|
||||
### Enable Developer Mode on your Windows 10 Development Device
|
||||
When you are developing on Windows 10, you choose what tasks you want to enable on the device. This includes any devices - Windows 10 desktops, tablets and phones. You can enable a device for development, or just app side loading. To enable _Developer mode_ on your Windows 10 device:
|
||||
|
||||
1. Click the Windows icon (typically in the lower-left of the screen, on the left-most side of the toolbar).
|
||||
2. Type __Update__ and select _Windows Update settings_ from the _Best match_ list. This will open the __UPDATE & SECURITY__ settings page.
|
||||
3. Click on __For developers__ in the left sidebar.
|
||||
4. Ensure the __Developer mode__ radio button is selected.
|
||||
5. Save your changes and close the _Settings_ window.
|
||||
|
||||
### Build the Samples
|
||||
Download the GrovePi repository to your development PC.
|
||||
|
||||
Each sample is its own solution. There are two ways to run the sample projects - within the GrovePi solution, or as individual solutions.
|
||||
|
||||
#### Samples as Part of GrovePi solution (recommended)
|
||||
When you run the samples as part of the GrovePi solution you know that you are using the very latest build of GrovePi, however; the samples are not part of the GrovePi solution by default - you must add them.
|
||||
|
||||
1. Open __GrovePi\Software\CSharp\GrovePi.sln__ in Visual Studio
|
||||
2. Right-click on the solution in the _Solution Explorer_
|
||||
3. Select __Add__ > __ New Solution Folder__
|
||||
4. Name the folder __Samples__
|
||||
5. Right-click on the solution in the _Solution Explorer_
|
||||
6. Select __Add__ > __ Existing Project__
|
||||
7. Find the __LightSensorLCDDisplay.csproj__ file - select it and click __Open__
|
||||
|
||||
This will add the _LightSensorLCDDisplay_ project to you new _Samples_ directory.
|
||||
|
||||
In the _LightSensorLCDDisplay_ project you need to update the reference to _GrovePi_.
|
||||
|
||||
1. In _Solution Explorer_ expand the _LightSensorLCDDisplay_ project and the _References_ node.
|
||||
2. Right-click on the __GrovePi__ reference and click __Remove_
|
||||
3. Right-click on the __References__ node and choose __Add Reference__
|
||||
4. Expand the __Projects__ node
|
||||
5. Select (by checking the check box) the __GrovePi__ project.
|
||||
6. Click __OK__
|
||||
|
||||
The project should now have all the updated references you need.
|
||||
|
||||
#### Samples as Independent Solutions
|
||||
When you run the sampels as independent solutions, you need to ensure you are referencing a current version of the GrovePi assembly (likely more current than the one available as a NuGet package).
|
||||
|
||||
The following steps assume you have already opened _GrovePi\Software\CSharp\GrovePi.sln_ in Visual Studio and built the solution. To build the solution, open GrovePi.sln, and click on press CTRL + SHIFT + B. Then close GrovePi.sln.
|
||||
|
||||
After building the GrovePi solution:
|
||||
1. Open __GrovePi\Software\CSharp\Samples\LightSensorLCDDisplay.sln__ in Visual Studio
|
||||
2. In _Solution Explorer_ expand the _LightSensorLCDDisplay_ project and the _References_ node.
|
||||
3. Right-click on the __GrovePi__ reference and click __Remove_
|
||||
4. Right-click on "References" and click "Add Reference".
|
||||
5. Select the __Browse__ tab and click the __Browse__ button.
|
||||
6. Browse to __GrovePi\Software\CSharp\GrovePi\bin\ARM\Debug__ and select the __GrovePi.dll__ file
|
||||
7. Click __OK__
|
||||
|
||||
The project should now have all the updated references you need.
|
||||
|
||||
### Setup the Hardware
|
||||
For this example program, connect the following:
|
||||
|
||||
1. Buzzer to __D5__ (Digital Pin 5)
|
||||
2. Button to __D2__ (Digital Pin 2)
|
||||
|
||||
### Run the Sample
|
||||
To run the sample...
|
||||
|
||||
1. Right-click on the _LightSensorLCDDisplay_ project in the _Solution Explorer_
|
||||
2. Select __Set as Startup Project__
|
||||
3. Right-click on the __Properties__ node under _LightSensorLCDDisplay_ and select __Open__
|
||||
4. Select the __Debug__ tab
|
||||
5. Select __Remote Machine__ in the _Target device_ field
|
||||
6. In the __Remote Machine__ field, Type in the name or IP Address of your Windows 10 IoT Core Raspberry Pi
|
||||
7. Press __Ctrl__ + __S__ (this file will not be saved automatically, you must save it manually).
|
||||
8. Press __F5__ to launch the debugger (it will take a minute or two to deploy your app onto the Raspberry Pi).
|
||||
109
Software/CSharp/Samples/Light_Sensor_LCDDisplay/StartupTask.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
// Use the RGB Display and the Light Sensor
|
||||
// In this example, we print the value of the light sensor on the RGB Display
|
||||
// and change the color of the RGB display based on the value of the light sensor.
|
||||
|
||||
|
||||
// The GrovePi connects the Raspberry Pi and Grove sensors.
|
||||
// You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
|
||||
|
||||
// This example combines the GrovePi + Light Sensor + RGB Display
|
||||
// http://www.dexterindustries.com/shop/grovepi-board/
|
||||
// http://www.seeedstudio.com/depot/Grove-LCD-RGB-Backlight-p-1643.html
|
||||
// http://www.dexterindustries.com/shop/grove-light-sensor/
|
||||
|
||||
// Hardware Setup:
|
||||
// Connect the Light Sensor to Analog Port 1.
|
||||
// Connect the RGB Display to any I2C Port.
|
||||
|
||||
/*
|
||||
The MIT License(MIT)
|
||||
|
||||
GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
|
||||
Copyright (C) 2016 Dexter Industries
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Windows.ApplicationModel.Background;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// Add using statements to the GrovePi libraries
|
||||
using GrovePi;
|
||||
using GrovePi.Sensors;
|
||||
using GrovePi.I2CDevices;
|
||||
|
||||
namespace LightSensorLCDDisplay
|
||||
{
|
||||
public sealed class StartupTask : IBackgroundTask
|
||||
{
|
||||
public void Run(IBackgroundTaskInstance taskInstance)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Starting program!");
|
||||
|
||||
// The RGB display is an I2C device and can be connected to any one of the I2C ports.
|
||||
IRgbLcdDisplay rgbdisplay = DeviceFactory.Build.RgbLcdDisplay();
|
||||
|
||||
// Connect the Light Sensor to analog port 1
|
||||
IRotaryAngleSensor lightsensor = DeviceFactory.Build.RotaryAngleSensor(Pin.AnalogPin1);
|
||||
double brightness = 0;
|
||||
|
||||
// Loop endlessly
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check the value of the button.
|
||||
brightness = lightsensor.SensorValue();
|
||||
|
||||
// Print out Brightness to Debug.
|
||||
System.Diagnostics.Debug.WriteLine("Raw Brightness is: " + brightness.ToString());
|
||||
|
||||
// Typecase the double to byte for the automatic brightness function!
|
||||
byte brightbyte = (byte)brightness; // The SetBacklightRgb function takes a byte type.
|
||||
// Set the display based on the light levels.
|
||||
rgbdisplay.SetBacklightRgb(brightbyte, brightbyte, brightbyte);
|
||||
|
||||
// Use a StringBuilder to assemble the display text
|
||||
StringBuilder lightstring = new StringBuilder();
|
||||
|
||||
// Print the value of the light sensor to the LCD Screen.
|
||||
lightstring.Append(brightness.ToString());
|
||||
System.Diagnostics.Debug.WriteLine("Display: " + lightstring.ToString());
|
||||
rgbdisplay.SetText(lightstring.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// NOTE: There are frequent exceptions of the following:
|
||||
// WinRT information: Unexpected number of bytes was transferred. Expected: '. Actual: '.
|
||||
// This appears to be caused by the rapid frequency of writes to the GPIO
|
||||
// These are being swallowed here/
|
||||
|
||||
// If you want to see the exceptions uncomment the following:
|
||||
// System.Diagnostics.Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
|
||||
// Delay in here to allow you to read the light sensor value.
|
||||
// If you don't include a short delay, the LCD screen will appear to be blank!
|
||||
Task.Delay(500).Wait(); //Delay 1 second
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
Software/CSharp/Samples/Light_Sensor_LCDDisplay/project.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
|
||||
},
|
||||
"frameworks": {
|
||||
"uap10.0": {}
|
||||
},
|
||||
"runtimes": {
|
||||
"win10-arm": {},
|
||||
"win10-arm-aot": {},
|
||||
"win10-x86": {},
|
||||
"win10-x86-aot": {},
|
||||
"win10-x64": {},
|
||||
"win10-x64-aot": {}
|
||||
}
|
||||
}
|
||||