Click here to Skip to main content
15,912,329 members
Home / Discussions / C#
   

C#

 
GeneralRe: how can reading bytes Pin
OriginalGriff1-May-15 6:08
mveOriginalGriff1-May-15 6:08 
GeneralRe: how can reading bytes Pin
Eddy Vluggen1-May-15 7:35
professionalEddy Vluggen1-May-15 7:35 
GeneralRe: how can reading bytes Pin
hasan hadi1-May-15 7:41
hasan hadi1-May-15 7:41 
GeneralRe: how can reading bytes Pin
Eddy Vluggen1-May-15 7:50
professionalEddy Vluggen1-May-15 7:50 
GeneralRe: how can reading bytes Pin
OriginalGriff1-May-15 8:01
mveOriginalGriff1-May-15 8:01 
GeneralRe: how can reading bytes Pin
Gerry Schmitz1-May-15 18:54
mveGerry Schmitz1-May-15 18:54 
GeneralRe: how can reading bytes Pin
hasan hadi1-May-15 19:34
hasan hadi1-May-15 19:34 
AnswerRe: how can reading bytes Pin
hasan hadi1-May-15 8:21
hasan hadi1-May-15 8:21 
Hi ,
this code is work but I have one problem
the problem in
ledArray1.SetValues(state_data,0,4)


this take Boolean array the c# message say cannot convert from byte[] to bool[] what can be doing?

this code is work

C#
private void button1_Click(object sender, EventArgs e)
      {
          int baud_rate;
          baud_rate = Convert.ToInt32(comboBox2.Text);
          MessageBox.Show("" + baud_rate);
          Port.Close();
          Port = new SerialPort(comboBox1.Text, baud_rate);
          Port.DataReceived += new SerialDataReceivedEventHandler(Port_DataReceived);

          Port.Open();
          button1.BackColor = Color.Lime;
      }

      string w;

      private void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
      {

           byte[] temp_read;
          temp_read = new byte[6];

          byte[] state_read;
          state_read = new byte[4];
          string w;
          w = Port.ReadTo("ST");
         if (w != string.Empty)
           {
               temp_read[0] = (byte)w[0];
               temp_read[1] = (byte)w[1];
               temp_read[2] = (byte)w[2];
               temp_read[3] = (byte)w[3];
               temp_read[4] = (byte)w[4];

               state_read[0] = (byte)w[5];
               state_read[1] = (byte)w[6];
               state_read[2] = (byte)w[7];
               state_read[3] = (byte)w[8];

               string ff = Encoding.UTF8.GetString(temp_read, 0, 5);
               float kk = Convert.ToSingle(ff);

               string ff1 = Encoding.UTF8.GetString(state_read, 0, 4);
               float kk1 = Convert.ToSingle(ff1);

               thermometer1.Value = kk;
               label1.Text = "" + kk1;

           }

      }


modified 1-May-15 14:27pm.

GeneralRe: how can reading bytes Pin
OriginalGriff1-May-15 8:34
mveOriginalGriff1-May-15 8:34 
GeneralRe: how can reading bytes Pin
hasan hadi1-May-15 19:15
hasan hadi1-May-15 19:15 
AnswerRe: how can reading bytes Pin
hasan hadi1-May-15 19:50
hasan hadi1-May-15 19:50 
QuestionHow to find references of a Property in the class through code? similar to 'Find All References' in Visual Studio Environment. Pin
Sid_ScienceKid1-May-15 3:18
Sid_ScienceKid1-May-15 3:18 
AnswerRe: How to find references of a Property in the class through code? similar to 'Find All References' in Visual Studio Environment. Pin
Eddy Vluggen1-May-15 3:29
professionalEddy Vluggen1-May-15 3:29 
GeneralRe: How to find references of a Property in the class through code? similar to 'Find All References' in Visual Studio Environment. Pin
Sascha Lefèvre1-May-15 3:38
professionalSascha Lefèvre1-May-15 3:38 
GeneralHow to read an array from 1 class to another Pin
yikes12330-Apr-15 19:21
yikes12330-Apr-15 19:21 
GeneralRe: How to read an array from 1 class to another Pin
Daniel Pfeffer30-Apr-15 20:42
professionalDaniel Pfeffer30-Apr-15 20:42 
GeneralRe: How to read an array from 1 class to another Pin
Richard MacCutchan30-Apr-15 21:16
mveRichard MacCutchan30-Apr-15 21:16 
GeneralRe: How to read an array from 1 class to another Pin
David A. Gray3-May-15 10:12
David A. Gray3-May-15 10:12 
Questionc sharp - Confusing string manipulation Pin
Member 1115178230-Apr-15 7:31
Member 1115178230-Apr-15 7:31 
AnswerRe: c sharp - Confusing string manipulation Pin
Matt T Heffron30-Apr-15 8:17
professionalMatt T Heffron30-Apr-15 8:17 
GeneralRe: c sharp - Confusing string manipulation Pin
David A. Gray1-May-15 11:13
David A. Gray1-May-15 11:13 
GeneralRe: c sharp - Confusing string manipulation Pin
Matt T Heffron1-May-15 11:31
professionalMatt T Heffron1-May-15 11:31 
GeneralRe: c sharp - Confusing string manipulation Pin
David A. Gray1-May-15 19:08
David A. Gray1-May-15 19:08 
QuestionCan any one help me to convert amatlab code to c# ,please? Pin
Member 1147426930-Apr-15 5:41
Member 1147426930-Apr-15 5:41 
AnswerRe: Can any one help me to convert amatlab code to c# ,please? Pin
OriginalGriff30-Apr-15 5:58
mveOriginalGriff30-Apr-15 5:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.