我的Arduino Uno有一个基本问题.
我的示例代码通过串口获取一个数字,并应将其打印回来.
int incomingByte = 0;
void setup() {
Serial.begin(9600);
Serial.println("Hello World");
}
void loop() {
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
Run Code Online (Sandbox Code Playgroud)
当我发送0时,我收到48.
0->48
1->49
2->50
3->51
a->97
b->98
A->65
Run Code Online (Sandbox Code Playgroud)
那么为什么不向我发回相同的数字呢?
我想在matlab中的图例中使用变量的名称.这可能吗?
我的例子是:
function example(x1)
figure;
plot(x1.time, x1.value);
legend(x1);
end
Run Code Online (Sandbox Code Playgroud)
现在我想调用我的函数:
>> example(myvariable)
Run Code Online (Sandbox Code Playgroud)
我的传奇应该是这样的:
---------------
| -- myvariable |
---------------
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.