Servo Control
The next step was to figure out how to operate a radio control(RC) servo as a proxy for an Electronic Speed Control(ESC).

My test rig uses (prices as at Aug 2020) the following parts
- Netduino 3 Wifi
- Grove-Base Shield V2.0 for Arduino USD4.45
- Grove-Universal 4 Pin Bucked 20cm cable(5 PCs Pack) USD2.90
- Grove-Servo USD5.90
- Grove-Rotary Angle Sensor USD2.90
My servo test harness
public class Program { public static void Main() { Debug.WriteLine("devMobile.Longboard.ServoTest starting"); try { AdcController adc = AdcController.GetDefault(); AdcChannel adcChannel = adc.OpenChannel(0); ServoMotor servo = new ServoMotor("TIM5", ServoMotor.ServoType.Positional, PinNumber('A', 0)); servo.ConfigurePulseParameters(0.6, 2.3); while (true) { double value = adcChannel.ReadRatio(); double position = Map(value, 0.0, 1.0, 0.0, 180); Debug.WriteLine($"Value: {value:F2} Position: {position:F1}"); servo.Set(position); Thread.Sleep(100); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } private static int PinNumber(char port, byte pin) { if (port < 'A' || port > 'J') throw new ArgumentException(); return ((port - 'A') * 16) + pin; } private static double Map(double x, double inputMinimum, double inputMaximum, double outputMinimum, double outputMaximum) { return (x - inputMinimum) * (outputMaximum - outputMinimum) / (inputMaximum - inputMinimum) + outputMinimum; } }
The nanoFramework code polls for the rotary angle sensor for its position every 100mSec and then updates the servo.
The servo code was based on sample code provided by GHI Electronics for their TinyCLR which I had to adapt to work with the nanoFramework.
The next test rig will be getting the Netduino 3 software working my Longboard ESC and Lithium Polymer(LiPo) batteries.