fixed copy/paste error

This commit is contained in:
lathoub 2020-09-27 13:36:16 +02:00
parent acd1d95001
commit d9fc069a4f
2 changed files with 11 additions and 24 deletions

View File

@ -7,6 +7,7 @@
BLEMIDI_CREATE_DEFAULT_INSTANCE()
unsigned long t0 = millis();
unsigned long t1 = millis();
bool isConnected = false;
// -----------------------------------------------------------------------------
@ -14,7 +15,7 @@ bool isConnected = false;
// -----------------------------------------------------------------------------
void setup()
{
Serial.begin(9600); // initialize serial communication
Serial.begin(115200); // initialize serial communication
while (!Serial);
MIDI.begin();
@ -42,8 +43,13 @@ void loop()
{
t0 = millis();
// MIDI.sendNoteOn (60, 100, 1); // note 60, velocity 127 on channel 1
// MIDI.sendNoteOff(60, 0, 1);
MIDI.sendNoteOn (60, 100, 1); // note 60, velocity 127 on channel 1
}
if (isConnected && (millis() - t1) > 1250)
{
t1 = millis();
MIDI.sendNoteOff(60, 0, 1);
}
}

View File

@ -30,28 +30,9 @@ public:
_characteristic->notify();
}
size_t available(uint8_t* buffer, size_t index, const size_t max)
size_t available(void *pvBuffer)
{
size_t length = uxQueueMessagesWaiting(mRxQueue);
if (0 == length) return 0;
Serial.print("nimBLE available: ");
while (xQueueReceive(mRxQueue, buffer + index++, 0))
{
Serial.print(" 0x");
Serial.print(buffer[index], HEX);
index++;
}
Serial.println("");
if (length > 0)
{
Serial.print("index: ");
Serial.println(length);
}
return length;
return xQueueReceive(mRxQueue, pvBuffer, 0); // return immediately when the queue is empty
}
/*