本文整理匯總了C#中MissionPlanner.Arduino.ArduinoSTK.uploadflash方法的典型用法代碼示例。如果您正苦於以下問題:C# ArduinoSTK.uploadflash方法的具體用法?C# ArduinoSTK.uploadflash怎麽用?C# ArduinoSTK.uploadflash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MissionPlanner.Arduino.ArduinoSTK
的用法示例。
在下文中一共展示了ArduinoSTK.uploadflash方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: BUT_copyto1280_Click
private void BUT_copyto1280_Click(object sender, EventArgs e)
{
IArduinoComms port = new ArduinoSTK();
port.BaudRate = 57600;
port.DataBits = 8;
port.StopBits = StopBits.One;
port.Parity = Parity.None;
port.DtrEnable = true;
StreamReader sr = new StreamReader(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"EEPROM1280.bin");
BinaryReader br = new BinaryReader(sr.BaseStream);
byte[] EEPROM = br.ReadBytes(1024 * 4);
br.Close();
sr.Close();
sr = new StreamReader(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + @"FLASH1280.bin");
br = new BinaryReader(sr.BaseStream);
byte[] FLASH = br.ReadBytes(1024 * 128);
br.Close();
sr.Close();
try
{
port.PortName = MissionPlanner.MainV2.comPortName;
port.Open();
if (port.connectAP())
{
log.Info("starting");
port.uploadflash(FLASH, 0, FLASH.Length, 0);
port.upload(EEPROM, 0, (short)EEPROM.Length, 0);
log.Info("Uploaded");
}
else
{
CustomMessageBox.Show("Communication Error - no connection");
}
port.Close();
}
catch (Exception ex) { CustomMessageBox.Show("Check port settings or Port in use? " + ex.ToString()); port.Close(); }
}