blob: 6559ae1c62ef138645349e0723b21feea193d9b0 (
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(STRING_DATA, stringCallback);
Firmata.attach(START_SYSEX, sysexCallback);
Firmata.begin(57600);
}
void loop()
{
while(Firmata.available()) {
Firmata.processInput();
}
}
|