我想啟動一輛 IR 遙控汽車,但由于我不太擅長在 Visual Studio 代碼中使用 C 編程,所以我想知道如何將遙控器傳輸的信號保存到我的 arduino 并將其保存到字串變數。我從互聯網上復制了這段代碼來獲取紅外信號:
#include <Arduino.h>
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
現在,我如何將“results.value,HEX”保存到字串中?
uj5u.com熱心網友回復:
String myString = String(results.value);
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/478124.html
上一篇:如何從字串中洗掉多個單詞Java
