Jimmy Engström

NAVIGATION

Using RC API on Windows 8.1

This is a short blog post on how to get RC API working on your Windows 8.1 Device.

Setup

Download RCAPI from Nuget

image_thumb[1]

 

Bluetooth

To be able to communicate thru Bluetooth you need to edit Package.appxmanifest

Add the following lines:

<Capabilities>
    ....
    <m2:DeviceCapability Name="bluetooth.rfcomm">
      <m2:Device Id="any">
        <m2:Function Type="name:serialPort" />
      </m2:Device>
    </m2:DeviceCapability>
  </Capabilities>

 

 

Pair with the device

Go into settings (win + c, Settings) , Change PC Settings, PC and Devices, Bluetooth

  image

 

The Car

Instantiate the car and you are good to go, the car class connects to the correct Bluetooth device automagically.

Ferrari458Italia ferrari = new Ferrari458Italia();

To start sending commands to the car you need to call the ConnectAsync method and call the Start method.

await ferrari.ConnectAsync();
ferrari.Start();

 

Controlling steering and speed

There are two properties controlling speed and steering.

Steering is –1 to 1 (left to right) and speed –1 to 1 (backward to forward).

In the sample projects I have used the Virtual Joystick project available on Codeplex for speed and steering, there is a modified version in the Windows Store sample project.

 

Controlling the lights

The lights are exposed through properties, to turn the light on use:

ferrari.HeadLightOn = true;

The lights available on the Ferrari 458 Italia is Headlights,blinkers (left and right) and break.

To get the lights to blink it is possible to supply an array with a light enum so if you want the blinkers to blink left

ferrari.LightSequence = new byte[] { (byte)LightEnum.LeftBlinker, 0 };

To get a more fun blinking sequence you might want to try something like this

ferrari.LightSequence = new byte[] { (byte)LightEnum.Head, (byte)LightEnum.RightBlinker, (byte)LightEnum.Break, (byte)LightEnum.LeftBlinker };

 

Trimmer

Trimmer property makes it possible to adjust the wheel orientation 0 to 15 and 8 is straight forward.

Posted in Gadgets,