Project

General

Profile

Statistics
| Branch: | Revision:

root / arduino-1.0 / libraries / Firmata / examples / EchoString / EchoString.ino @ 58d82c77

History | View | Annotate | Download (971 Bytes)

1
/*
2
 * Firmata is a generic protocol for communicating with microcontrollers
3
 * from software on a host computer. It is intended to work with
4
 * any host computer software package.
5
 *
6
 * To download a host software package, please clink on the following link
7
 * to open the download page in your default browser.
8
 *
9
 * http://firmata.org/wiki/Download
10
 */
11

    
12
/* This sketch accepts strings and raw sysex messages and echos them back.
13
 *
14
 * This example code is in the public domain.
15
 */
16
#include <Firmata.h>
17

    
18
byte analogPin;
19

    
20
void stringCallback(char *myString)
21
{
22
    Firmata.sendString(myString);
23
}
24

    
25

    
26
void sysexCallback(byte command, byte argc, byte*argv)
27
{
28
    Firmata.sendSysex(command, argc, argv);
29
}
30

    
31
void setup()
32
{
33
    Firmata.setFirmwareVersion(0, 1);
34
    Firmata.attach(STRING_DATA, stringCallback);
35
    Firmata.attach(START_SYSEX, sysexCallback);
36
    Firmata.begin(57600);
37
}
38

    
39
void loop()
40
{
41
    while(Firmata.available()) {
42
        Firmata.processInput();
43
    }
44
}
45

    
46