Skip to content

Commit 9a2248c

Browse files
committed
rpi test
1 parent 9658198 commit 9a2248c

File tree

9 files changed

+131
-93
lines changed

9 files changed

+131
-93
lines changed

Test.RPiConsoleNet/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62

73
namespace Test.RPiConsoleNet
84
{
9-
class Program
5+
internal class Program
106
{
11-
static void Main(string[] args)
7+
private static void Main(string[] args)
128
{
9+
// https://docs.microsoft.com/en-us/visualstudio/debugger/remote-debugging-csharp?view=vs-2019
10+
// http://raspberrypi-aa.github.io/session2/led_control.html
11+
12+
Console.WriteLine("Hey you, over there!");
1313
}
1414
}
15-
}
15+
}

Test.RPiWinNet/Form1.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Test.RPiWinNet/Form1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Windows.Forms;
33

4-
namespace Test.RaspberryPiNet
4+
namespace Test.RPiWinNet
55
{
66
public partial class Form1 : Form
77
{

Test.RPiWinNet/Program.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
52
using System.Windows.Forms;
63

7-
namespace Test.RaspberryPiNet
4+
namespace Test.RPiWinNet
85
{
9-
static class Program
6+
internal static class Program
107
{
118
/// <summary>
129
/// The main entry point for the application.
1310
/// </summary>
1411
[STAThread]
15-
static void Main()
12+
private static void Main()
1613
{
1714
Application.EnableVisualStyles();
1815
Application.SetCompatibleTextRenderingDefault(false);
1916
Application.Run(new Form1());
2017
}
2118
}
22-
}
19+
}

Test.RPiWinNet/Properties/Resources.Designer.cs

Lines changed: 48 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Test.RPiWinNet/Properties/Settings.Designer.cs

Lines changed: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Test.RPiWinNet/Test.RPiWinNet.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
77
<ProjectGuid>{200BC1A0-8477-47C8-B3B2-FA17EFA7FBD5}</ProjectGuid>
88
<OutputType>WinExe</OutputType>
9-
<RootNamespace>Test.RaspberryPiNet</RootNamespace>
10-
<AssemblyName>Test.RP.WinNet</AssemblyName>
9+
<RootNamespace>Test.RPiWinNet</RootNamespace>
10+
<AssemblyName>Test.RPiWinNet</AssemblyName>
1111
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@@ -65,6 +65,7 @@
6565
<Compile Include="Properties\Resources.Designer.cs">
6666
<AutoGen>True</AutoGen>
6767
<DependentUpon>Resources.resx</DependentUpon>
68+
<DesignTime>True</DesignTime>
6869
</Compile>
6970
<None Include="Properties\Settings.settings">
7071
<Generator>SettingsSingleFileGenerator</Generator>

Test.RaspberryNet.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BBEB846-2945-4C5F-91B4-771EEC14DCB1}"
77
ProjectSection(SolutionItems) = preProject
88
.editorconfig = .editorconfig
9+
LICENSE = LICENSE
10+
readme.md = readme.md
11+
Test.RaspberryNet.sln.licenseheader = Test.RaspberryNet.sln.licenseheader
912
EndProjectSection
1013
EndProject
1114
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.RPiConsoleNet", "Test.RPiConsoleNet\Test.RPiConsoleNet.csproj", "{3FC0863B-677D-40DC-9CB7-745ABF872D39}"

readme.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Intro
22
This example uses C# for Raspberry Pi 3 and demonstrates remote debugging.
33

4+
Fore note, all tests are performed using vs2019 (v16.4), RaspberryPi 3b v1.2 w/ Raspbian v9.
5+
46
## Linux - Launching the app
57
To launch your app using a clickable link on Desktop Linux.
68

@@ -21,10 +23,57 @@ sudo chmod +x TestPi.sh
2123

2224
Give it a try by double clicking your file via the Desktop.
2325

26+
## Raspberry Pi GPIO
27+
* https://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29
28+
29+
### .NET Core IoT
30+
The C# snip below can be found at the [.NET Core IoT samples](https://github.com/dotnet/iot/blob/master/samples/led-blink/README.md).
31+
32+
**Requires:**
33+
* Red LED (1.8 - 2.2 Vf)
34+
* 100K resistor
35+
* GPIO pin 17 and GND.
36+
37+
```cs
38+
int pin = 17;
39+
GpioController controller = new GpioController();
40+
controller.OpenPin(pin, PinMode.Output);
41+
42+
// Blink the LED
43+
int lightTimeInMilliseconds = 1000;
44+
int dimTimeInMilliseconds = 200;
45+
46+
while (true)
47+
{
48+
Console.WriteLine($"Light for {lightTimeInMilliseconds}ms");
49+
controller.Write(pin, PinValue.High);
50+
51+
Thread.Sleep(lightTimeInMilliseconds);
52+
Console.WriteLine($"Dim for {dimTimeInMilliseconds}ms");
53+
54+
controller.Write(pin, PinValue.Low);
55+
Thread.Sleep(dimTimeInMilliseconds);
56+
}
57+
```
58+
2459
## Resources
60+
**Raspberry Pi GPIO**
61+
* .NET Core IoT [System.Device.Gpio](https://github.com/dotnet/iot) - 2019-12-22
62+
* [Samples](https://github.com/dotnet/iot/blob/master/samples/README.md) for .NET Core 2.1 and 3.0.
63+
* Supports Raspberry Pi 2B, 3, and 4 models (ARMv7/v8).
64+
* Raspberry Pi Zero or Arduino is not supported at this time (2019-12-27)
65+
* [Raspberry-GPIO-Manager](https://github.com/AlexSartori/Raspberry-GPIO-Manager) - 2018-01-20
66+
* [RaspberryPi.Net](https://github.com/cypherkey/RaspberryPi.Net) - 2017-05-06
67+
* http://raspberrypi-aa.github.io/session2/led_control.html
68+
* https://www.hanselman.com/blog/InstallingTheNETCore2xSDKOnARaspberryPiAndBlinkingAnLEDWithSystemDeviceGpio.aspx
69+
70+
71+
**Remote Debugging:**
72+
* [Connect VS to remote Linux](https://docs.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer?view=vs-2019)
2573
* [VSMonoDebugger](https://marketplace.visualstudio.com/items?itemName=GordianDotNet.VSMonoDebugger0d62)
2674
* https://github.com/GordianDotNet/VSMonoDebugger
27-
* Tested and does upload but failed to debug out of the box. (vs2019, RPi3 w/ Raspbian 9)
75+
* Tested uploading EXE works
76+
* Tested remote debugging and it fails out of the box.
2877
* [Mono Remote Debugger](https://marketplace.visualstudio.com/items?itemName=Bongho.MonoRemoteDebugger)
2978
* https://github.com/techl/MonoRemoteDebugger
3079
* [MSDN Thread](https://social.msdn.microsoft.com/Forums/vstudio/en-US/0654a5e4-42ba-4ebd-95b0-1a729d41f4d3/debugging-mono-apps-from-visual-studio?forum=vsdebug)

0 commit comments

Comments
 (0)