blob: ed13ad846c559f5b1191c7a81a5a727c56f36929 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* This sketch accepts strings and raw sysex messages and echos them back.
*
* This example code is in the public domain.
*/
#include <Firmata.h>
byte analogPin;
void stringCallback(char *myString)
{
Firmata.sendString(myString);
}
void sysexCallback(byte command, byte argc, byte*argv)
{
Serial.print(START_SYSEX, BYTE);
Serial.print(command, BYTE);
for(byte i=0; i<argc; i++) {
Serial.print(argv[i], BYTE);
}
Serial.print(END_SYSEX, BYTE);
}
void setup()
{
Firmata.setFirmwareVersion(0, 1);
Firmata.attach(FIRMATA_STRING, stringCallback);
Firmata.attach(START_SYSEX, sysexCallback);
Firmata.begin();
}
void loop()
{
while(Firmata.available()) {
Firmata.processInput();
}
}
|