private async void CheckForOreCallback(object info) { if (alreadyRunning) { await _misty.SendDebugMessageAsync("Already running, please wait."); return; } alreadyRunning = true; await _misty.ChangeLEDAsync(0, 255, 0); celebrationCount = 0; await LoadModelAsync(); if (tof.GetRearCenterDistance() < 0.25) { tof.SetFarEnoughThresholdDistance(0.25, true); tof.FarEnough += InitialDistanceCheck; await _misty.DriveAsync(15, 0); } else { RunCustomVision(); } }
public async void OnStart(object sender, IDictionary <string, object> parameters) { //callback example _misty.ChangeLED(255, 36, 0, OnResponse); _misty.Wait(2000); //second callback example _misty.ChangeLED(0, 36, 255, OnResponse); _misty.Wait(1500); //async example await _misty.ChangeLEDAsync(255, 140, 0); //event registration _misty.RegisterBumpSensorEvent(BumpCallback, 0, true, null, null, null); }
// Delegate:x in the recipe file will result in this method being called with argument = x private async Task <bool> MyDelegateAsync(string argument) { _skillHelper.LogMessage("Executing delegate."); // Your code here. Whatever you want. await _misty.ChangeLEDAsync(50, 100, 100); return(true); }