private void Light_Sensor_Load(object sender, EventArgs e) { UInt16 LastErrCode; byte[] byLibVersion = new byte[LightSensor_API.IMC_LIB_VERSION_SIZE]; LastErrCode = LightSensor_API.LightSensor_GetLibVersion(byLibVersion); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get library version"); return; } int nRealSize; StaticLibVersionValue.Text = ConvertByte2String(byLibVersion, byLibVersion.Length, out nRealSize); }
private void button1_Click(object sender, EventArgs e) { UInt16 light_value; UInt16 LastErrCode; unsafe { LastErrCode = LightSensor_API.LightSensor_GetStatus(out light_value); if (LastErrCode != IMC_ERR_NO_ERROR) { MessageBox.Show("Fails to get library version"); return; } } textBox1.Text = light_value.ToString(); }