【发布时间】:2014-04-10 16:15:23
【问题描述】:
我已将效果处理器 midi 连接到 shield 中的 arduino midi 我正在尝试使用 arduino 的 Midi 库读取来自我的效果处理器的 sysex 消息 一切运行良好,但是当涉及到十六进制数 F7 时,我的 arduino 读取为 0。 我知道 F7 是 247 有人知道为什么会这样吗?
我用这个代码
#include <MIDI.h>
void handle_sysex(byte *a,byte sizeofsysex)
{
Serial.println(sizeofsysex,DEC);
for(int n=0;n<sizeofsysex;n++)
{
Serial.print(a[n]);
Serial.print(" ");
}
Serial.print('\n');
}
void setup() {
Serial.begin(9600);
// Initiate MIDI communications, listen to all channels
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandleSystemExclusive(handle_sysex);
}
void loop() {
// Call MIDI.read the fastest you can for real-time performance.
MIDI.read();
}
【问题讨论】:
-
这是唯一错误的数字吗?或者它是一个值范围?你怎么知道正在发送什么值?
-
是的,它是唯一的,我知道因为我还连接了 Midi Ox 以检查 arduino 是否读取正确
-
难道
F7是“消息结尾”字符,它只是被转换为“字符串结尾”吗?见en.wikipedia.org/wiki/… -
@Floris 在 MIDI 中,0 是有效的数据字节;转换 F7 将是一个可怕的错误。