1. 程式人生 > >IRremote類庫中涉及的Container for received IR codes

IRremote類庫中涉及的Container for received IR codes

       在Arduino中對紅外遙控的無線通訊程式設計時,要用到decode_results結構,該結構的成員如下:



       假如定義了一個紅外接收的類物件:IRrecv irrecv( 這裡是紅外一體化接收頭連線到Arduino的引腳);

      又定義了 儲存編碼結果的物件:decode_results results;

      那麼,對接收到的紅外資訊進行解碼後,即:irrecv.decode(&results);

      就可以得到物件results的值。這些值得表示如下:

        results.decode_type: Will be one of the following: NEC, SONY, RC5, RC6, or UNKNOWN.
        results.value: The actual IR code (0 if type is UNKNOWN)
        results.bits: The number of bits used by this code
        results.rawbuf: An array of IR pulse times
        results.rawlen: The number of items stored in the array