-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35b9f68
commit ec2ae6e
Showing
8 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
*.obj | ||
*.pdb | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.cache | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.scc | ||
*.sdf | ||
[Bb]in | ||
[Dd]ebug*/ | ||
obj/ | ||
[Rr]elease*/ | ||
_ReSharper*/ | ||
[Tt]est[Rr]esult* | ||
[Bb]uild[Ll]og.* | ||
*.[Pp]ublish.xml | ||
BuildProcessTemplates/* | ||
Published/* | ||
[Tt]humbs.db | ||
[Uu]pgradeLog*.[Xx][Mm][Ll] | ||
_[Uu]pgradeReport_Files*/ | ||
*.build.csdef | ||
[Pp]ackage/* | ||
ASPNETDB.MDF | ||
aspnetdb_log.ldf | ||
*.sap | ||
*/PerformanceLogs/* | ||
!Debugging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
namespace ColourWheel | ||
{ | ||
public struct ColorRGB | ||
{ | ||
public uint R; | ||
public uint G; | ||
public uint B; | ||
|
||
public static ColorRGB Hsl2Rgb(double h, double sl, double l) | ||
{ | ||
double r = l; | ||
double g = l; | ||
double b = l; | ||
double v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl); | ||
|
||
if (v > 0) | ||
{ | ||
double m = l + l - v; | ||
double sv = (v - m) / v; | ||
h *= 6.0; | ||
int sextant = (int) h; | ||
double fract = h - sextant; | ||
double vsf = v * sv * fract; | ||
double mid1 = m + vsf; | ||
double mid2 = v - vsf; | ||
|
||
switch (sextant) | ||
{ | ||
case 0: | ||
r = v; | ||
g = mid1; | ||
b = m; | ||
break; | ||
case 1: | ||
r = mid2; | ||
g = v; | ||
b = m; | ||
break; | ||
case 2: | ||
r = m; | ||
g = v; | ||
b = mid1; | ||
break; | ||
case 3: | ||
r = m; | ||
g = mid2; | ||
b = v; | ||
break; | ||
case 4: | ||
r = mid1; | ||
g = m; | ||
b = v; | ||
break; | ||
case 5: | ||
r = v; | ||
g = m; | ||
b = mid2; | ||
break; | ||
} | ||
} | ||
|
||
ColorRGB rgb; | ||
rgb.R = (uint) (r * 255.0f); | ||
rgb.G = (uint) (g * 255.0f); | ||
rgb.B = (uint) (b * 255.0f); | ||
return rgb; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<AssemblyName>ColourWheel</AssemblyName> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>ColourWheel</RootNamespace> | ||
<ProjectTypeGuids>{b69e3092-b931-443c-abe7-7e7b65f2a37f};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<ProductVersion>9.0.21022</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{13F1B785-AAEA-489D-A92C-862486DCF552}</ProjectGuid> | ||
<TargetFrameworkVersion>v4.1</TargetFrameworkVersion> | ||
<NetMfTargetsBaseDir Condition="'$(NetMfTargetsBaseDir)'==''">$(MSBuildExtensionsPath32)\Microsoft\.NET Micro Framework\</NetMfTargetsBaseDir> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<Import Project="$(NetMfTargetsBaseDir)$(TargetFrameworkVersion)\CSharp.Targets" /> | ||
<ItemGroup> | ||
<Compile Include="ColorRGB.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Program.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.SPOT.Hardware" /> | ||
<Reference Include="Microsoft.SPOT.Native" /> | ||
<Reference Include="Microsoft.SPOT.Net" /> | ||
<Reference Include="SecretLabs.NETMF.Hardware" /> | ||
<Reference Include="SecretLabs.NETMF.Hardware.NetduinoPlus" /> | ||
<Reference Include="System" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColourWheel", "ColourWheel.csproj", "{13F1B785-AAEA-489D-A92C-862486DCF552}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{13F1B785-AAEA-489D-A92C-862486DCF552}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Threading; | ||
using SecretLabs.NETMF.Hardware; | ||
using SecretLabs.NETMF.Hardware.NetduinoPlus; | ||
|
||
namespace ColourWheel | ||
{ | ||
public class Program | ||
{ | ||
public static void Main() | ||
{ | ||
var ledR = new PWM(Pins.GPIO_PIN_D9); | ||
var ledG = new PWM(Pins.GPIO_PIN_D6); | ||
var ledB = new PWM(Pins.GPIO_PIN_D5); | ||
|
||
while (true) | ||
{ | ||
for (double i = 0; i < 1; i += 0.003) | ||
{ | ||
var c = ColorRGB.Hsl2Rgb(i, 1.0, 0.5); | ||
|
||
ledR.SetPulse(255, c.R); | ||
ledG.SetPulse(255, c.G); | ||
ledB.SetPulse(255, c.B); | ||
|
||
Thread.Sleep(25); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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("ColourWheel")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ColourWheel")] | ||
[assembly: AssemblyCopyright("Copyright © 2011")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Please see: | ||
http://jonrea.co.uk for all infromation relating to this code |