| 数据搜索系统,热门电子元器件搜索 |
|
DFR0274 数据表(PDF) 8 Page - DFROBOT |
|
|
|||||||||||||||||||||||||||||
DFR0274 数据表(HTML) 8 Page - DFROBOT |
|
8 / 12 page ![]() while(pulseIn(IR_PIN, HIGH) < BIT_START); read_pulse(pulse); pulse_to_bits(pulse, bits); RemoteVerify(bits); return bits_to_int(bits); } /* use pulseIn to receive IR pulses from the remote. Record the length of these pulses (in ms) in an array */ void read_pulse(int pulse[]) { for (int i = 0; i < IR_BIT_LENGTH; i++) { pulse[i] = pulseIn(IR_PIN, HIGH); } } /* IR pulses encode binary "0" as a short pulse, and binary "1" as a long pulse. Given an array containing pulse lengths, convert this to an array containing binary values */ void pulse_to_bits(int pulse[], int bits[]) { if (debug) { Serial.println("-----"); } for(int i = 0; i < IR_BIT_LENGTH; i++) { if (debug) { Serial.println(pulse[i]); } if(pulse[i] > BIT_1) //is it a 1? { bits[i] = 1; } else if(pulse[i] > BIT_0) //is it a 0? { bits[i] = 0; } else //data is invalid... { Serial.println("Error"); } } } /* check returns proper first 14 check bits */ void RemoteVerify(int bits[]) { int result = 0; int seed = 1; |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |