Main Site Documentation

Documentation and release notes


#1

The website is still being updated to handle the user privileges but I can share the new documentation and release notes with everyone

Documentation: (see USB Client)
http://www.ghielectronics.com/downloads/NETMF_Beta/Library/Index.html

Release Notes:
http://www.tinyclr.com/release-notes-beta/

This code emulates a USB mouse and moves it in a circle…This is how you can freak out your friends, wife and kids…put this program on FEZ and make the mouse movement run randomly every few minutes. Then plug FEZ behind someone’s computer. While they are using the computer, the mouse will start going in a circle on its own…“oh my god! it is a ghost!!!” :wink:
If you actually tried this trick on someone, please let us know how much fun you had :smiley:

Have fun…

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.USBClient;
using GHIElectronics.NETMF.Hardware;

namespace USBClient_Example
{
    public class Program
    {
        public static void Main()
        {
            // Check debug interface
            if (Configuration.DebugInterface.GetCurrent() == Configuration.DebugInterface.Port.USB1)
                throw new InvalidOperationException("Current debug interface is USB. It must be changed to something else before proceeding. Refer to your platform user manual to change the debug interface.");

            // Start Mouse
            USBC_Mouse mouse = USBClientController.StandardDevices.StartMouse();

            // Move pointer in a swirl
            const int ANGLE_STEP_SIZE = 7;
            const int MIN_CIRCLE_DIAMETER = 50;
            const int MAX_CIRCLE_DIAMETER = 300;
            const int CIRCLE_DIAMETER_STEP_SIZE = 1;

            int diameter = MIN_CIRCLE_DIAMETER;
            int diameterIncrease = CIRCLE_DIAMETER_STEP_SIZE;
            int angle = 0;
            int factor;

            while (true)
            {
                // Check if connected to PC
                if (USBClientController.GetState() != USBClientController.State.Running)
                {
                    Debug.Print("Waiting to connect to PC...");
                }
                else
                {
                    // Note Mouse X, Y are reported as change in position (relative position, not absolute)
                    factor = diameter * ANGLE_STEP_SIZE * (int)System.Math.PI / 180 / 2;
                    int dx = (-1 * factor * (int)Microsoft.SPOT.Math.Sin(angle) / 1000);
                    int dy = (factor * (int)Microsoft.SPOT.Math.Cos(angle) / 1000);

                    angle += ANGLE_STEP_SIZE;
                    diameter += diameterIncrease;

                    if (diameter >= MAX_CIRCLE_DIAMETER ||
                        diameter <= MIN_CIRCLE_DIAMETER
                        )
                        diameterIncrease *= -1;

                    // report mouse position
                    mouse.SendData(dx, dy, 0, USBC_Mouse.Buttons.BUTTON_NONE);
                }

                Thread.Sleep(10);
            }
        }
    }
}

#2

Pranking someone was actually my first thought when I saw the post about the new SDK :stuck_out_tongue:


#3

mine too! :stuck_out_tongue:

Cool Gus, I will try it out some time :smiley: