Jimmy Engström

NAVIGATION

Using RC API on Windows Phone

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

Setup

Download RCAPI from Nuget

image

 

Capabilities

To be able to communicate thru Bluetooth you need to enable ID_CAP_Proximity.

Open WMAppManifest.xml and make sure ID_CAP_Proximity is ticked.

  image

 

Pair with the device

Open Settings, Bluetooth and pair the phone with your device.

 

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.

 

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, Windows Phone