-3
我是新來的c編程,並試圖比較IR HEX字符串。我越來越 - 錯誤:作爲賦值的左操作數所需的左值。IR HEX比較
我的東西我的問題是圍繞線路31 這裏是代碼:
/* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
String stringAppleUp;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.println ("See it");
stringAppleUp = string('77E150BC'); //apple remote up button
if ( ???? = stringAppleUp) {
Serial.println("yes");
}
else
{
Serial.println("No");
}
irrecv.resume(); // Receive the next value
}
}
行:如果(??? = stringAppleUp) 我不知道把什麼變量,其中的???是。
感謝您的幫助。 將
這功課嗎? – L0j1k 2013-02-27 13:21:30
呃,我們應該怎麼知道你想放哪個變量?但是有兩個問題:'如果(a = b)'不檢查'a'是否等於'b',並且'string('77E150BC')'可能不會做你認爲的那樣。 – us2012 2013-02-27 13:22:43
這是C還是C++? (問題的主體說C,所以我編輯了標籤,但看着代碼,我不確定。)無論如何,你可能在'if'條件下表示'==',而不是'='。 – geoffspear 2013-02-27 13:22:53