Giter Site home page Giter Site logo

raspberrypi.net's Introduction

RaspberryPi.Net

Introduction

The purpose of this library is to provide a Mono.NET interface to the GPIO pins on the Raspberry Pi. All of this code was written using Visual Studio 2010 Express but the goal is to be fully compatible with Mono. This library is written using .NET 4.0 therefore the latest version of Mono (2.10) is recommended. At the time of this update, the Raspbian wheezy 2012-07-15 image installs Mono 2.10.8.1.

The GPIO pins are best described here. They can be accessed in 2 ways, either using the file-based I/O (GPIOFile.cs) or direct memory (GPIOMem.cs) using Mike McCauley's BCM2835 library which is available here. There is also a GPIODebug.cs class that can be used to test your application without a Raspberry Pi.

Here is a sample bit of code to blink an LED attached to pin 12

using System;
using RaspberryPiDotNet;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            GPIOMem led = new GPIOMem(GPIOPins.V2_GPIO_12)
            while(true)
            {
                led.Write(PinState.High);
                System.Threading.Thread.Sleep(500);
                led.Write(PinState.Low);
                System.Threading.Thread.Sleep(500);
            }
        }
    }
}

Installing Mono

To install Mono on your Raspberry Pi, run the following:

$ sudo aptitude update 
$ sudo aptitude install mono-runtime

My preference is for aptitude, however, apt-get can also be used.

Using GPIOMem

The GPIOMem class uses the .NET Interop layer to expose C functions from Mike McCauley''s BCM2835 library. This requires the use of a separate shared object (.so) but this library is considerably faster than the GPIOFile method.

The Makefile for his library compiles a shared object where a statically linked library is required. To compile a statically linked binary, do the following:

# tar -zxf bcm2835-1.3.tar.gz
# cd bcm2835-1.3/src
# make libbcm2835.a
# cc -shared bcm2835.o -o libbcm2835.so

You can also try using our own compiled file here. If it doesn't work, you must compile yourself. It must be in the same folder as the application.

Liquid Crystal Display

This class is a port of the MicroLiquidCrystal NetDuino library from here. It provides an interface to address HD44780 compatible displays.

Example code:

RaspPiGPIOMemLcdTransferProvider lcdProvider = new RaspPiGPIOMemLcdTransferProvider(
    GPIOPins.Pin_P1_21,
    GPIOPins.Pin_P1_18,
    GPIOPins.Pin_P1_11,
    GPIOPins.Pin_P1_13,
    GPIOPins.Pin_P1_15,
    GPIOPins.Pin_P1_19);


Lcd lcd = new Lcd(lcdProvider);
lcd.Begin(16, 2);
lcd.Clear();
lcd.SetCursorPosition(0, 0);
lcd.Write("Hello World!");

Using MCP3008

This class is a port of a Python Script by Mikey Sklar here. It provides analog to digital conversion to the Raspberry Pi.

The following example shows how to connect an analog temperature sensor to the Pi.

Example code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using RaspberryPiDotNet;

namespace RPi_Temperature
{
    class Program
    {
        static void Main(string[] args)
        {
            //# set up the SPI interface pins
            //# SPI port on the ADC to the Cobbler
            GPIOMem SPICLK = new GPIOMem(GPIOPins.Pin_P1_18, GPIODirection.Out);
            GPIOMem SPIMISO = new GPIOMem(GPIOPins.Pin_P1_23, GPIODirection.In);
            GPIOMem SPIMOSI = new GPIOMem(GPIOPins.Pin_P1_24, GPIODirection.Out);
            GPIOMem SPICS = new GPIOMem(GPIOPins.Pin_P1_22, GPIODirection.Out);

            // temperature sensor connected to channel 0 of mcp3008
            int adcnum = 0;
            double read_adc0 = 0.0;

            while (true)
            {
                MCP3008 MCP3008 = new MCP3008(adcnum, SPICLK, SPIMOSI, SPIMISO, SPICS);
                // read the analog pin (temperature sensor LM35)
                read_adc0 = MCP3008.AnalogToDigital;
                double millivolts = Convert.ToDouble(read_adc0) * (3300.0 / 1024);

                double volts = (Convert.ToDouble(read_adc0) / 1024.0f) * 3.3f;
                double temp_C = ((millivolts - 100.0) / 10.0) - 40.0;
                double temp_F = (temp_C * 9.0 / 5.0) + 32;

# if DEBUG
                System.Console.WriteLine("MCP3008_Channel: " + adcnum);
                System.Console.WriteLine("read_adc0: " + read_adc0);
                System.Console.WriteLine("millivolts: " + (float)millivolts);
                System.Console.WriteLine("tempC: " + (float)temp_C);
                System.Console.WriteLine("tempF: " + (float)temp_F);
                System.Console.WriteLine("volts: " + (float)volts);
		//The following line makes the trick on Raspberry Pi for displaying DateTime.Now
		//equivalent.
		Console.WriteLine("Date time stamp: {0}/{1}/{2} {3}:{4}:{5}",now.Month,now.Day,now.Year,
		                  now.Hour,now.Minute,now.Second);
		System.Console.WriteLine("\n");
# endif
                Thread.Sleep(3000);
            }
        }
    }
}

raspberrypi.net's People

Contributors

brunoamancio avatar bryant1410 avatar cypherkey avatar ferraripr avatar pmprog avatar stonie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspberrypi.net's Issues

RaspberryPiDotNet xbuild with 31 errors

Hello guys,

I want to write code for the RaspberryPi in C# with Mono. That works pretty well.

But I need also to work with the GPIO-Pins.

When I want to build the RaspberryPiDotNet-Project, it throws me 31 errors, like this one:

CSC: error CS0518: The predefined type `System.RuntimeTypeHandle' is not defined or imported

Every error is the same, but instead of 'System.RuntimeTypeHandle' are everytime different things.

GPIO16 ("OK" LED)

Just a question, I wondered is there a reason why GPIO16 (i.e. the "OK" LED) was left out?

I tried adding it and was able to pulse the 'OK' LED on my RPi using this code

If there is a good reason then no problem, as I'm new to RPi, I'm not sure about this.

Btw, thanks for putting up this repo - it helped me out a great deal!

HD44780 wire diagram

Hi,
First off all thanks for the Great libary.

How i have to wire a HD44780 Display?

Greets
Johann

GPIOFile direction being ignored

Taking into consideration this code
_ButtonGPIO = new GPIOFile((GPIOPins)GPIOPin, GPIODirection.In);
When this code runs, doing less /sys/class/gpio/gpio10/direction (10 because it's the value of the GPIOPin variable) returns Out.
The problem here is that the constructor referred above calls the public GPIOFile(GPIOPins pin, GPIODirection direction, bool initialValue) with false on the initialValue parameter. This one calls the base with: our pin, GPIODirection.In, false. The code for setting the PinDirection is the following

PinDirection = direction;
Write(initialValue);

and the Write method is (partially) defined as this:

        PinDirection = GPIODirection.Out;```

This setting will ALWAYS override the direction set.

My suggestion is that there should be another constructor on the `public abstract class GPIO : IDisposable`
I can try and contribute for that, but for that I would like you to DM me so that I can understand the process :)

some help - GPIOFile

Hello

I'm quite new in this topic. But trying to acess the GPIO using the RaspberryPi.Net.
Compiling and adding the dll to the reference worked fine, as well no errors in the test code.
I prefer to use the GPIOFile method instead the GPIOMem
But when I run the applcation on the Pi I get some errors. Mono framework is working on the Pi for other applications.

Test code:
using System;
using Gtk;
using RaspberryPiDotNet;

public partial class MainWindow: Gtk.Window
{
public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();
}

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
    Application.Quit ();
    a.RetVal = true;
}

protected void OnButton2Clicked (object sender, EventArgs e)
{
    GPIOFile led = new GPIOFile(GPIOPins.Pin_P1_23);
    led.Write (true);

}

protected void OnButton3Clicked (object sender, EventArgs e)
{
    GPIOFile led = new GPIOFile(GPIOPins.Pin_P1_24);
    led.Write (true);

}

}

Errors:
Marshaling clicked signal
Exception in Gtk# callback delegate
Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path "/sys/class/gpio/gpio8/direction".
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x001c6] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.IO/FileStream.cs:282
at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00039] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.IO/StreamWriter.cs:120
at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] in :0
at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.IO/File.cs:576
at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.IO/File.cs:571
at RaspberryPiDotNet.GPIOFile.set_PinDirection (GPIODirection value) [0x0004c] in /Users/reschmann/RaspberryPiDotNet/GPIOFile.cs:71
at RaspberryPiDotNet.GPIO..ctor (GPIOPins pin, GPIODirection direction, Boolean initialValue) [0x0006d] in /Users/reschmann/RaspberryPiDotNet/GPIO.cs:88
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:234
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System.Reflection/MethodBase.cs:96
at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000bf] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System/Delegate.cs:413
at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System/MulticastDelegate.cs:70
at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.12/_build/mono-2.10.12.git/mcs/class/corlib/System/Delegate.cs:387
at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in :0
at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in :0
at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in :0
at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
at Gtk.Application.gtk_main()
at Gtk.Application.Run()

Any idea where the problem could be?
Many thanks for your help for a rookie...

A redundant ExportPin() call

    public GPIOMem(GPIOPins pin, DirectionEnum direction)
        : base(pin, direction, false)
    {
        // Isn't this next line redundant? the above base constructor call will make the same call.
        ExportPin(pin, direction);
    }

P.S. I would issue a pull request but haven't got git setup where I am right now.

I Have A Problem

Hello (Sorry my English for now)

I Compiled and installed bcm2835 library.
I tried the c++ code and i run c++ code perfectly.

After i run this command and this is run perfectly.

make libbcm2835.a
cc -shared bcm2835.o -o libbcm2835.so

i tried your simple blink led code but i've take some errors.
not find .so library.

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for RaspberryPiDotNet.GPIOMem ---> System.DllNotFoundException: libbcm2835.so
at (wrapper managed-to-native) RaspberryPiDotNet.GPIOMem:bcm2835_init ()
at RaspberryPiDotNet.GPIOMem..cctor () [0x00000] in :0
--- End of inner exception stack trace ---
at Test.Program.Main (System.String[] args) [0x00000] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for RaspberryPiDotNet.GPIOMem ---> System.DllNotFoundException: libbcm2835.so
at (wrapper managed-to-native) RaspberryPiDotNet.GPIOMem:bcm2835_init ()
at RaspberryPiDotNet.GPIOMem..cctor () [0x00000] in :0
--- End of inner exception stack trace ---
at Test.Program.Main (System.String[] args) [0x00000] in :0

Please help me.
Thanks

SPI Support

Hello,
my knowledge about the SPI-Interface is nearly zero, but i need it for controlling a display. The raspberry has SPI-Pins. Will you support SPI with this library?

Greetings,
Sebastian

Cannot Use pin with multiple instances Exeption

Hi,

i have a problem:
System.Exeption: Cannot use pin with multiple instances. Unexport the previous instance with Dispose() first (pin 24)

I have only one instance of pin 24 in my Code and I get this Exeption where ever I delcare.

in_gpio24 = new GPIOMem(GPIOPins.V2_GPIO_24, GPIODirection.In);

Raspberry Pi 2

I'm quite new to programming so please help me to fix this problem

PinState always Low.

Hi guys...

I ran into a problem... I received my Pi 2 days ago and since that im trying to get my code working on that machine. The problem is even when I press one of the 4 buttons I need to have - the PinState still stays at low.

I already checked it with Python and its fully working there.

Codesnippet:

    public static GPIOMem btn1 = new GPIOMem(GPIOPins.V2_Pin_P1_03, GPIODirection.In);
    public static GPIOMem btn2 = new GPIOMem(GPIOPins.V2_Pin_P1_05, GPIODirection.In);
    public static GPIOMem btn3 = new GPIOMem(GPIOPins.V2_Pin_P1_07, GPIODirection.In);
    public static GPIOMem btn4 = new GPIOMem(GPIOPins.V2_Pin_P1_08, GPIODirection.In);

    Console.WriteLine("State: " + btn1.Read() + " " + btn2.Read() + " " + btn3.Read() + " " + btn4.Read());

And the Output is:

State: Low Low Low Low

Hope you got an Idea to help me with that little problem...

Can't get it to work on RPI 2B

I've tried using the wrapper on the Raspberry Pi 2B but i cant get it to to work. I tried bcm2835 1.3, 1.39 and 5.0 but none of them works.I am not getting any errors, it just doesn't change the pins state.
RPITest.zip

Problem with Read GPIO

Hi there,

i have a Problem with reading a GPIO Value. I have written a litte source code in Visual Basic and C# too:

        GPIOFile gpio17 = new GPIOFile(GPIOPins.V2_GPIO_17);
        GPIOFile gpio24 = new GPIOFile(GPIOPins.V2_GPIO_24);
        while(true)
        {
            gpio17.Write(gpio24.read());

        }

My Compiler gives me the error, that the Method "Read" ist not presend in the .dll?

Does anyone have a solution for that?

edit: compiling the code direct on the pi2 is working, but on my pc with visual Basic not

Sorry for my bad english, it´s not my native language

"Get Started" guide?

I would love to use .Net on my brand new Pi but I have no idea what your project needs to get me up and running.
I assume that there are lots of .Net devs out there who want to tinker with a Pi, but don't have the experience to get something like this going on their own. A "Get Started" guide would be immensely helpful.

Support setting input pin pull-up/-down

Thank you for writing this library. It's great.

Any thoughts on allowing the setting of the pull-up/down resistors when setting a pin to input? The default of off if usually fine, but there are times where it would be handy to use the internal resistors.

Thanks.

Problem With MCP3008

hello all,
I am new with c# and I was trying to use the MCP3008.cs to read a potentiometer values but the value is always fixed to zero.
Reffering to the issues previously published:

  • I have changed GPIO / GPIOMem in MCP3008.cs
    But still the value doesn't change

Please does any body have an idea what could the problem be
PS: I have tried My mcp with PYTHON and it woks well.

Supporting Board Rev2

Hey,
since the board Rev2 has changed some GPIO numbers, you should modify the GPIPins-enum.

Documentation: http://elinux.org/RPi_Low-level_peripherals#General_Purpose_Input.2FOutput_.28GPIO.29

Source changes:

public enum GPIOPins
{
GPIO_NONE = -1,
GPIO00 = 0,
GPIO01 = 1,

        GPIO02 = 2, //REV2
        GPIO03 = 3, //REV2

        GPIO04 = 4,
        GPIO07 = 7,
        GPIO08 = 8,
        GPIO09 = 9,
        GPIO10 = 10,
        GPIO11 = 11,
        GPIO14 = 14,
        GPIO15 = 15,
        GPIO17 = 17,
        GPIO18 = 18,
        GPIO21 = 21,
        GPIO22 = 22,
        GPIO23 = 23,
        GPIO24 = 24,
        GPIO25 = 25,

        GPIO27 = 27, //REV2

        Pin03 = 2, //REV2
        Pin05 = 3, //REV2
        Pin07 = 4,
        Pin08 = 14,
        Pin10 = 15,
        Pin11 = 17,
        Pin12 = 18,
        Pin13 = 27, //REV2
        Pin15 = 22,
        Pin16 = 23,
        Pin18 = 24,
        Pin19 = 10,
        Pin21 = 9,
        Pin22 = 25,
        Pin23 = 11,
        Pin24 = 8,
        Pin26 = 7,
        LED = 16
    };

Greetings,
Sebastian

I2C and UART support

Hello,

I'd like to ask if the library provides support of I2C and UART.

Thanks.

How to communicate to simple SPI chip

Hi,
thank you for your great work.
can you give me one raw example to communicate with other system using SPI using raspberry pi as master, raspberry should send two bytes and it will receive 10 bytes in return. the SPI clock is 1000000.

thanks,

Compilation error TM1638.cs, 112

Hi,

under mono develop 2.8.6.3 I see a compilation error in TM1638.cs

line 112: Error CS0172: Type of conditional expression cannot be determined as byte' andint' convert implicitly to each other (CS0172)

I don’t have a TM1638 to test with, but I suspect you can change the second expression to something like this: (byte)(data | (dot ? ((byte)1) : ((byte)0)))

;)
Thanks,
Stonie.

Question about library features

Does this library have PWM capability? Are you planning to introduce that in near future?.

Another important thing that I wanted to ask is if it is possible to access Raspberry Serial port(standard RS232 UART) to connect to a standard PC via its serial port.?

I have a raspberry pi and the setup to test if somebody wants to test,

Thanks,
Nouman

xbuild error

Hi!
There is a little problem with xbuild.
Compiling "xbuild RaspberryPiDotNet.csproj" isn't working with the Mono Version 3.2.8.0, XBuild Engine 12.0

Error message:

Project "/home/pi/dev/RaspberryPi.Net/RaspberryPiDotNet/RaspberryPiDotNet.csproj" (default target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: AnyCPU
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Target GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
Target CoreCompile:
Tool /usr/bin/dmcs execution started with arguments: /noconfig /debug:full /debug+ /optimize- /out:obj/Debug/RaspberryPiDotNet.dll DS1620.cs GPIO.cs GPIODebug.cs GPIODirection.cs GPIOFile.cs GPIOMem.cs GPIOPins.cs GPIOResistor.cs MCP3008.cs MicroLiquidCrystal/RaspPiGPIOFileLcdTransferProvider.cs MicroLiquidCrystal/RaspPiGPIOMemLcdTransferProvider.cs MicroLiquidCrystal/ILcdTransferProvider.cs MicroLiquidCrystal/Lcd.cs PinState.cs Properties/AssemblyInfo.cs TM16XX/TM1638.cs TM16XX/TM16XX.cs /target:library /define:"DEBUG;TRACE" /doc:bin/Debug/RaspberryPiDotNet.XML /reference:/usr/lib/mono/4.0/System.dll /reference:/usr/lib/mono/4.0/System.Core.dll /warn:4
DS1620.cs(92,42): error CS0589: Internal compiler error during parsingSystem.FormatException: Input string was not in the correct format
at System.Double.Parse (System.String s, NumberStyles style, IFormatProvider provider) [0x00000] in :0
at Mono.CSharp.Tokenizer.adjust_real (TypeCode t, Location loc) [0x00000] in :0
at Mono.CSharp.Tokenizer.is_number (Int32 c, Boolean dotLead) [0x00000] in :0
at Mono.CSharp.Tokenizer.xtoken () [0x00000] in :0
at Mono.CSharp.Tokenizer.token () [0x00000] in :0
at Mono.CSharp.CSharpParser.yyparse (yyInput yyLex) [0x00000] in :0
at Mono.CSharp.CSharpParser.parse () [0x00000] in :0
Task "Csc" execution -- FAILED
Done building target "CoreCompile" in project "/home/pi/dev/RaspberryPi.Net/RaspberryPiDotNet/RaspberryPiDotNet.csproj".-- FAILED
Done building project "/home/pi/dev/RaspberryPi.Net/RaspberryPiDotNet/RaspberryPiDotNet.csproj".-- FAILED

Build FAILED.
Errors:

/home/pi/dev/RaspberryPi.Net/RaspberryPiDotNet/RaspberryPiDotNet.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->

    DS1620.cs(92,42): error CS0589: Internal compiler error during parsingSystem.FormatException: Input string was not in the correct format

     0 Warning(s)
     1 Error(s)

Based on the following tutorial:
http://stackoverflow.com/questions/23639895/include-bcm2853-lib-on-raspberry-pi

error with lib bcm2835_init()

after i run this script i got error below
any help please
the dll for RaspberyPiDotNet.dll and so file is already shared in gpio_csharp

using System;
using RaspberryPiDotNet;

namespace Test
{
class Program
{
static void Main(string[] args)
{
GPIOMem led = new GPIOMem(GPIOPins.V2_GPIO_12)
while(true)
{
led.Write(PinState.High);
System.Threading.Thread.Sleep(500);
led.Write(PinState.Low);
System.Threading.Thread.Sleep(500);
}
}
}
}

System.TypeInitializationException : An exception was thrown by the type initializer for RassberryPiDotNet.GPIOMem --->System.Exception:libbcm2835.so
at (wrapper managed-to-native)RaspberryPiDontNet.GPIOMem:bcm2835_init()
at RaspberryPiDotNet.GPIOMem..cctor()[0x00001]in

Unable to use MCP3008

I have trying to use MCP3008 to read analogue voltages from pi, but strangely its not working. The ADC value read from any channel gives either 0 or 6596.77 millivolts using the same code as used in the Mcp3008 example code.

Do I have the hardware circuit right? Its attached
Would be waiting for any help in this regard.

raspberry

GPIOResistor setting

Hi,

Please could you help me with a (hopefully) small problem:
I have set up an input:
GPIOMem Inter = new GPIOMem(GPIOPins.Pin_P1_24, GPIODirection.In, false);

But I am trying to set the pull up/down resistor to off and cannot seem to do it. Is there something stupid I am missing?

Thanks

Unable to switch Pins

I wrote an little Programm to set my GPIO-Pins but i'm only able switch Pin_P1_08, Pin_P1_10 and Pin_P1_13.

I use GPIOMem for example:
GPIOMem pin03 = new GPIOMem(GPIOPins.V2_Pin_P1_03, GPIODirection.Out,false);

To switch the status of the Pin i use:
if (pin03.Read())
pin03.Write(false);
else
pin03.Write(true);

The Programm compiles and runs without any Exceptions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.