Raptor and Camera - possible code issue or just me?

Anyone have a camera ( https://www.ghielectronics.com/catalog/product/283 ) working with a raptor as I’m getting the following error.

A first chance exception of type ‘System.ArgumentException’ occurred in mscorlib.dll
Error invoking method “Gadgeteer.Modules.GHIElectronics.Camera” (check arguments to Program.BeginInvoke are correct)

This occurs after I try to take a picture

 
            if (camera.CameraReady)
            {
                camera.TakePicture();
            }

Thanks

That’s funny, because we know that BeginInvoke is not implemented in NETMF. It’s there, but you can not even decompile the method.

@ Reinhard Ostermeier - I think you are confusing Delegate.BeginInvoke with Dispatcher.BeginInvoke. Delegate.BeginInvoke is not implemented, but .NETMF has a Dispatcher which is primarily used to marshal calls across threads and it has a method called BeginInvoke, this is similar to the desktop Framework.

Other then a couple of minor quibbles, like this, I think I have found myself a new favorite board as this Raptor is a brute looking for a place to happen. I’m loading this sucker up and it just mashes the tasks I’m giving it.

Another issue would be how do I get the IP Address from a wifi connection so I can setup a webserver on the raptor as there doesn’t appear to be wifi_RS21.Interface.NetworkInterface.IPAddress

ipconfig /all. :whistle:

@ Duke Nukem - Make a little server on PC. Connect from Raptor and check the incoming IP.

What I need is the IP Address of the Wifi connection on the Raptor so I can do this:


 _showData = WebServer.SetupWebEvent("index.html");
 _showData.WebEventReceived += _showData_WebEventReceived;
 WebServer.StartLocalServer(Whatever my IPAddress is, 80);

Just trying to build up a Gadgeteer Demo that shows off a pile of Gadgeteer features, including @ Justin RF Pipes ( https://www.ghielectronics.com/community/creations/entry/12 ) as those are so freaking easy to use, even I got them going on the first crack.

@ Duke Nukem - At what point in your code are you calling camera.TakePicture()? If you are calling it in ProgramStarted, then the Gadgeteer framework is not completely initialized.

Try firing the call in a timer that triggers sometime after ProgramStarted has completed.

The code below worked for me on my Raptor.


using Microsoft.SPOT;
using GT = Gadgeteer;
using Gadgeteer.Modules.GHIElectronics;

namespace Raptor1
{
    public partial class Program
    {
        GT.Timer _timer;
        
        void ProgramStarted()
        {
            _timer = new GT.Timer(1000);
            _timer.Tick += _timer_Tick;
            _timer.Start();

            camera.PictureCaptured += camera_PictureCaptured;

            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
        }

        void camera_PictureCaptured(Camera sender, GT.Picture picture)
        {
            display_T35.SimpleGraphics.DisplayImage(picture, 0, 0);
        }

        void _timer_Tick(GT.Timer timer)
        {
            if (camera.CameraReady)
            {
                camera.TakePicture();
            }
        }
    }
}

@ taylorza thanks the bug was in my code in the camera_PictureCaptured routine around how I was trying to create a filename so save the picture with, so its my bad. I should have put a breakpoint in the routine when I first saw the error and it would have shown me what the problem was, I incorrectly assumed the error was in the call to take the picture, but really it was my code in the saving of the picture.

@ Duke Nukem - Well, it gave me an excuse to finally connect my new Raptor :slight_smile: