source: rtos_arduino/trunk/arduino_lib/libraries/Firmata/examples/EchoString/EchoString.ino@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 935 bytes
Line 
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
18void stringCallback(char *myString)
19{
20 Firmata.sendString(myString);
21}
22
23
24void sysexCallback(byte command, byte argc, byte*argv)
25{
26 Firmata.sendSysex(command, argc, argv);
27}
28
29void setup()
30{
31 Firmata.setFirmwareVersion(0, 1);
32 Firmata.attach(STRING_DATA, stringCallback);
33 Firmata.attach(START_SYSEX, sysexCallback);
34 Firmata.begin(57600);
35}
36
37void loop()
38{
39 while (Firmata.available()) {
40 Firmata.processInput();
41 }
42}
43
44
Note: See TracBrowser for help on using the repository browser.