Put this code on dev board with UC55 and run without debugger. Now, open TinyCLR config and attach. The buzzing will double ins speed!
using System.Threading;
using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Devices.Pwm;
using GHIElectronics.TinyCLR.Pins;
using System.Runtime.InteropServices;
class Program {
static void Blinker() {
var LED = GpioController.GetDefault().OpenPin(UCMStandard.GpioPin.C);
LED.SetDriveMode(GpioPinDriveMode.Output);
var state = false;
while (true) {
state = !state;
LED.Write(state? GpioPinValue.High: GpioPinValue.Low);
Thread.Sleep(100);
}
}
private static void Main() {
UCMStandard.SetModel(UCMModel.UC5550);
new Thread(Blinker).Start();
//System.IntPtr address = 0x12345678;
var address = new System.IntPtr(0x12345678);
Marshal.WriteInt32(address, Marshal.ReadInt32(address) (1<<3));
var freeq = 1000;
var BuzzerCon = PwmController.FromName(UCMStandard.PwmChannel.A.Id);
var BuzzerChan = BuzzerCon.OpenChannel(UCMStandard.PwmChannel.A.Pin);
BuzzerChan.SetActiveDutyCyclePercentage(0.5);
BuzzerCon.SetDesiredFrequency(freeq);
BuzzerChan.Start();
while (true) {
BuzzerCon.SetDesiredFrequency(freeq);
if ((freeq += 100) > 5000)
freeq = 1000;
Thread.Sleep(20);
}
}
}
Put this code on dev board with UC55 and run without debugger. Now, open TinyCLR config and attach. The buzzing will double ins speed!