Today we decided to add some async/await automation... and to let Sphero dance....
Thanks to async/await, the code for dance sequence is easy - it looks like:
private async Task Dance() { Stop(); Color(0,0,0); Tail(0); await TailTo100Over10(); await OneSecond(); PulseWhiteEverySecond(6); Color(0,200,0); for (var i = 0; i < 5; i++ ) await ZigZag(); for (var i = 0; i < 3; i++) await Sequence1(); for (var i = 0; i < 3; i++) await Sequence2(); for (var i = 0; i < 20; i++) { await Sequence1(); await Sequence2(); }
}
We also added multiple Sphero control from the same phone - will show that as soon as the video arrives :) :) :)
Is that in a windows phone PCL? I didn't think that mono touch/droid had async await support.
ReplyDeleteWell spotted. This code was actually hacked in for demo only. Currently, PCLs can do async/await in winrt and wp if you use the bcl pack. Then if you use the code from @dsplaisted's BUILD talk, then it will also work in monodroid - it's just monotouch that's missing - and @dsplaisted almost got there at BUILD - but I think it needed just a little monotouch change. Hopefully soon we'll get an amazing Xmas present from xamarin :)
ReplyDelete