SBC4 and C#

General PhidgetSBC Discussion.
Post Reply
bkuehner
Fresh meat
Posts: 1
Joined: Mon May 01, 2023 10:35 pm
Contact:

SBC4 and C#

Post by bkuehner »

I have an SBC4 that I'd like to run C# code on. I've installed mono, and demonstrated that I can run a Hello World app that prints to the console.
I am now trying to compile same RFID reader code (the code generated by the Code Samples page).

I run the mcs command like this (*** replaces NET, because of the overzealous link protection on the forum):

Code: Select all

mcs /r:Phidget22.***.dll Program.cs
and I get an error:

Code: Select all

Program.cs(8,71): error CS0012: The type `System.EventArgs' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
/root/monorfid/Phidget22.***.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
Any suggestions as to what I might be doing wrong?

Here's the mono version info:

Code: Select all

mono --version
Mono JIT compiler version 6.12.0.182 (tarball Tue Jun 14 22:42:26 UTC 2022)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.***
        TLS:           __thread
        SIGSEGV:       normal
        Notifications: epoll
        Architecture:  armel,vfp+hard
        Disabled:      none
        Misc:          softdebug
        Interpreter:   yes
        LLVM:          yes(610)
        Suspend:       preemptive
        GC:            sgen (concurrent by default)

The program:

Code: Select all

using System;
using Phidget22;

namespace MannequinPhidget
{
    class Program
    {
        private static void Rfid0_Tag(object sender, Phidget22.Events.RFIDTagEventArgs e)
        {
            Console.WriteLine("Tag: " + e.Tag);
            Console.WriteLine("Protocol: " + e.Protocol);
            Console.WriteLine("----------");
        }

        private static void Rfid0_TagLost(object sender, Phidget22.Events.RFIDTagLostEventArgs e)
        {
            Console.WriteLine("Tag: " + e.Tag);
            Console.WriteLine("Protocol: " + e.Protocol);
            Console.WriteLine("----------");
        }

        static void Main(string[] args)
        {
            RFID rfid0 = new RFID();

            rfid0.DeviceSerialNumber = 428654;

            rfid0.Tag += Rfid0_Tag;
            rfid0.TagLost += Rfid0_TagLost;

            rfid0.Open(5000);

            //Wait until Enter has been pressed before exiting
            Console.ReadLine();

            rfid0.Close();
        }
    }
}
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests