Jawab using API communications in C#

  • 02 Februari 2012 3:57
     
     

    Hi,

    Does anyone know how to program XBee in API communications?

    • Dipindahkan oleh Leo Liu - MSFT 03 Februari 2012 6:14 Moved for better support. (From:Visual C# Language)
    •  

Semua Balasan

  • 03 Februari 2012 7:54
    Pemilik
     
     

    I'm not sure that this is a Robotics question. XBee can be used for Robotics, but there RDS does not include a service for it so you would have to write your own. I think that the XBee controller on the PC end looks like a virtual serial port, so the Serial Port service might work.

    Trevor

     

  • 03 Februari 2012 8:21
     
     

    Hi, This is what i receive from serial port (7E 00 12 92 0013 A2 00 40 6B 68 BB 4F 01 01 00 02 00 00 00 4F). How do I program it whenever it receive "7E" so that it will trigger the stopwatch?

    Thank you.

  • 05 Februari 2012 3:07
    Pemilik
     
     

    I'm confused. This is still not a question about RDS. If you are already receiving the data, what is the difficulty in executing some code whenever you see a 7E in the data stream?

    Trevor

     


  • 05 Februari 2012 4:26
     
     
    I need some starting guide codes to program whenever it receive "7E" to trigger the stopwatch.
  • 06 Februari 2012 20:56
    Moderator
     
     Jawab Memiliki Kode
    List<byte> streamBuffer = new List<byte>()
    {
        0x7E, 0x00, 0x12, 0x92, 0x00, 
        0x13, 0xA2, 0x00, 0x40, 0x6B, 
        0x68, 0xBB, 0x4F, 0x01, 0x01,
        0x00, 0x02, 0x00, 0x00, 0x00, 
        0x4F 
    };
     
    foreach (byte value in streamBuffer)
    { 
        if(value == 0x7E)
        {
            // Start StopWatch
     
     
            // If done with processing current streamBuffer break out of the foreach loop
            break;
        }
        else
        {
            continue;
        }
    }