我已經看到了多行的多行HTML的方法,但我發現更方便的是這一個,(除了有一個方法,在一個單獨的頁面上的HTML將是可怕的)。不過,當我嘗試在arduino ide上進行編譯時出現錯誤。這是我得到的錯誤:多行HTML代碼錯誤
bitluniHomeAutomation:64: error: stray '\342' in program
const char* msj = R」foo(
^
bitluniHomeAutomation:64: error: stray '\200' in program
bitluniHomeAutomation:64: error: stray '\235' in program
bitluniHomeAutomation:70: error: stray '#' in program
background-color: #990033;
^
bitluniHomeAutomation:77: error: stray '\342' in program
</style>」
^
bitluniHomeAutomation:77: error: stray '\200' in program
bitluniHomeAutomation:77: error: stray '\235' in program
bitluniHomeAutomation:78: error: stray '\342' in program
</head>」
^
bitluniHomeAutomation:78: error: stray '\200' in program
bitluniHomeAutomation:78: error: stray '\235' in program
bitluniHomeAutomation:79: error: stray '\342' in program
<body>」
^
bitluniHomeAutomation:79: error: stray '\200' in program
bitluniHomeAutomation:79: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
<input type=」button」 class=」button」 value=」Input Button」>
^
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:80: error: stray '\342' in program
bitluniHomeAutomation:80: error: stray '\200' in program
bitluniHomeAutomation:80: error: stray '\235' in program
bitluniHomeAutomation:83: error: missing terminating " character
)foo";
^
/Users/carlospiasentini/Documents/Arduino/bitluniHomeAutomation/bitluniHomeAutomation.ino: In function 'void cssButton()':
bitluniHomeAutomation:64: error: 'R' was not declared in this scope
const char* msj = R」foo(
^
bitluniHomeAutomation:77: error: expected ',' or ';' before '<' token
</style>」
^
bitluniHomeAutomation:85: error: 'message' was not declared in this scope
message.replace("[[MODE]]", String(inputMode));
^
bitluniHomeAutomation:85: error: 'inputMode' was not declared in this scope
message.replace("[[MODE]]", String(inputMode));
^
exit status 1
stray '\342' in program
,這是我的html代碼
void cssButton() {
const char* msj = R」foo(
<!DOCTYPE html>
<html>
<head>
<style>
.button {
background-color: #990033;
border: none;
color: white;
padding: 7px 15px;
text-align: center;
cursor: pointer;
}
</style>」
</head>」
<body>」
<input type=」button」 class=」button」 value=」Input Button」>
</body>
</html>
)foo";
String message = String(msj);
message.replace("[[MODE]]", String(inputMode));
server.send(200, "text/html", message);
}
我這樣稱呼它:
server.on("/button", cssButton);
您正在使用捲曲的引號。別。 –
您的程序中有捲曲的引號。你必須使用ASCII雙引號。 – Barmar
[爲什麼此字符的ASCII表示形式返回爲226 128 153?]可能重複(https://stackoverflow.com/questions/28286059/why-is-ascii-representation-of-this-character-returns-as- 226-128-153) –