Reference.Firmata History

Hide minor edits - Show changes to markup

June 03, 2010, at 05:24 PM by Equipo Traduccion -
Changed line 61 from:

void analogWriteCallback(byte pin, int value)

to:

void analogWriteCallback(byte pin, int valor)

Changed line 64 from:
    analogWrite(pin, value);
to:
    analogWrite(pin, valor);
June 03, 2010, at 05:23 PM by Equipo Traduccion -
Changed line 48 from:
FIRMATA_STRING
Strings de C-Style, utiliza stringCallbackFunction para el tipo de función
to:
FIRMATA_STRING
Strings de estilo C, utiliza stringCallbackFunction para el tipo de función
Changed lines 59-60 from:

byte analogPin;

to:

byte pinAlalogico;

Changed lines 79-80 from:
    for(analogPin = 0; analogPin < TOTAL_ANALOG_PINS; analogPin++) {
        Firmata.sendAnalog(analogPin, analogRead(analogPin)); 
to:
    for(pinAlalogico = 0; pinAlalogico < TOTAL_ANALOG_PINS; pinAlalogico++) {
        Firmata.sendAnalog(pinAlalogico, analogRead(pinAlalogico)); 
June 03, 2010, at 05:20 PM by Equipo Traduccion -
Changed line 34 from:
generic
void callbackFunction(byte pin, int value);
to:
generic
void callbackFunction(byte pin, int valor);
Changed line 36 from:
string
void stringCallbackFunction(char *myString);
to:
string
void stringCallbackFunction(char *miString);
Changed lines 39-53 from:

Message Types

These are the various message types that you can attach functions to.

ANALOG_MESSAGE
the analog value for a single pin
DIGITAL_MESSAGE
8-bits of digital pin data (one port)
REPORT_ANALOG
enable/disable the reporting of analog pin
REPORT_DIGITAL
enable/disable the reporting of a digital port
SET_PIN_MODE
change the pin mode between INPUT/OUTPUT/PWM/etc.
FIRMATA_STRING
C-style strings, uses stringCallbackFunction for the function type
SYSEX_START
generic, arbitrary length messages (via MIDI SysEx protocol), uses sysexCallbackFunction for the function type
SYSTEM_RESET
message to reset firmware to its default state, uses systemResetCallbackFunction for the function type

Example

to:

Tipos de Mensajes

Estos don varios tipos de mensajes que puedes vincular a las funciones.

ANALOG_MESSAGE
el valor analógico para un único pin
DIGITAL_MESSAGE
Los 8-bits de datos del pin digital (un puerto)
REPORT_ANALOG
habilitar/deshabilitar el informe de un pin analógico
REPORT_DIGITAL
habilitar/deshabilitar el informe de un puerto digital
SET_PIN_MODE
Cambia el modo del pin entre INPUT/OUTPUT/PWM/etc.
FIRMATA_STRING
Strings de C-Style, utiliza stringCallbackFunction para el tipo de función
SYSEX_START
Genérico, mensajes de longitud arbitraria (vía protocolo MIDI SysEx), emplea sysexCallbackFunction para el tipo de función
SYSTEM_RESET
Mensaje para resetear el firmware a us estado por defecto , utiliza systemResetCallbackFunction para el tipo de función

Ejemplo

June 03, 2010, at 02:39 PM by Equipo Traduccion -
Changed lines 32-33 from:

In order to attach your function to a message type, your function must match the standard callback function. There are currently three types of callback functions in Firmata: generic, string, and sysex.

to:

A la hora de vincular tu función a un tipo de mensaje, tu función debe ajustarse a la función de retrollamada estándar. Actualmente hay tres tipos de funciones de retrollamada en Firmata: generic, string, and sysex.

June 03, 2010, at 02:35 PM by Equipo Traduccion -
June 03, 2010, at 02:35 PM by Equipo Traduccion -
Changed lines 25-33 from:
available()

check to see if there are any incoming messages in the buffer

processInput()
process incoming messages from the buffer, sending the data to any registered callback functions
attach(byte command, callbackFunction myFunction)
attach a function to an incoming message type
detach(byte command)
detach a function from an incoming message type

Callback Functions

to:
available()
Chequea si hay algún mensaje entrante en el buffer
processInput()
Procesa los mensajes entrantes en el buffer, enviando los datos a cualquier función de retrollamada registrada
attach(byte command, funcionRetrollamada miFuncion)
Vincula una función a un tipo de mensaje de entrada
detach(byte command)
Desvincula una función de un tipo de mensaje de entrada

Funciones de retrollamada (Callback)

June 03, 2010, at 01:17 PM by Equipo Traduccion -
Changed lines 16-25 from:

Sending Messages

sendAnalog(byte pin, int value)
send an analog message
sendDigitalPorts(byte pin, byte firstPort, byte secondPort)
send digital ports as individual bytes
sendDigitalPortPair(byte pin, int value)
send digital ports as one int
sendSysex(byte command, byte bytec, byte* bytev)
send a command with an arbitrary array of bytes
sendString(const char* string)
send a string to the host computer
sendString(byte command, const char* string)
send a string to the host computer using a custom command type

Receiving Messages

available()
check to see if there are any incoming messages in the buffer
to:

Enviando mensajes

sendAnalog(byte pin, int valor)
Envía un mensaje analógico
sendDigitalPorts(byte pin, byte puertoPrimario, byte puertoSecundario)
Envía los puertos digitales como bytes individuales
sendDigitalPortPair(byte pin, int valor)
Envía los puertos digitales como un entero (int)
sendSysex(byte comando, byte bytec, byte* bytev)
Envía un comando con un array arbitrario de bytes
sendString(const char* string)
Envía un String al ordenador servidor usando tipo de comando personalizado
sendString(byte comando, const char* string)
Envía un string al ordendor servidor usando un tipo de comando personalizado

Recibiendo mensajes

available()

check to see if there are any incoming messages in the buffer

June 03, 2010, at 01:11 PM by Equipo Traduccion -
Changed lines 10-16 from:
begin(long)
start the library and override the default baud rate
printVersion()
send the protocol version to the host computer
blinkVersion()
blink the protocol version on pin 13
printFirmwareVersion()
send the firmware name and version to the host computer
setFirmwareVersion(byte major, byte minor)
set the firmware name and version, using the sketch's filename, minus the .pde

to:
begin(long)
Inicia la librería y sobreescribe el ratio de baudios por defecto
printVersion()
Envía la versión del protocolo al ordenador servidor
blinkVersion()
Parpadea la versión del protocolo en el pin 13
printFirmwareVersion()
Envía el nombre del firmware al ordenador servidor
setFirmwareVersion(byte mayor, byte menor)
Establece el nombre del firmware y la versión, usando el nombre del sketch, menos .pde
June 02, 2010, at 10:54 PM by Equipo Traduccion -
Changed line 9 from:
begin()
start the library
to:
begin()
Inicia la librería
June 02, 2010, at 10:54 PM by Equipo Traduccion -
Changed line 2 from:

Firmata - Library - Baud Rate Details - Protocol Details - Protocol Proposals

to:

Firmata - Library - Detalles del ratio de baudios - Detalles del Protocolo - Prouestas de Protocolo

Changed lines 4-8 from:

Firmata Library

The Firmata library implements the Firmata protocol for communicating with software on the host computer. This allows you to write custom firmware without having to create your own protocol and objects for the programming environment that you are using.

Methods

to:

Librería Firmata

La librería Firmata implementa el protocolo Firmata que permite comunicarse con un software alojado en un ordenador servidor. Esto permite escribir un firmware personalizado sin tener que crear tu propio protocolo y objetos, para el entorno de programación que estás usando.

Métodos

November 25, 2008, at 08:28 PM by Hans Steiner -
Deleted line 0:
Added lines 2-3:

Firmata - Library - Baud Rate Details - Protocol Details - Protocol Proposals


November 25, 2008, at 08:24 PM by Hans Steiner -
Added lines 1-84:

Firmata? - Library - Baud Rate Details? - Protocol Details? - Protocol Proposals?


Firmata Library

The Firmata library implements the Firmata protocol for communicating with software on the host computer. This allows you to write custom firmware without having to create your own protocol and objects for the programming environment that you are using.

Methods

begin()
start the library
begin(long)
start the library and override the default baud rate
printVersion()
send the protocol version to the host computer
blinkVersion()
blink the protocol version on pin 13
printFirmwareVersion()
send the firmware name and version to the host computer
setFirmwareVersion(byte major, byte minor)
set the firmware name and version, using the sketch's filename, minus the .pde

Sending Messages

sendAnalog(byte pin, int value)
send an analog message
sendDigitalPorts(byte pin, byte firstPort, byte secondPort)
send digital ports as individual bytes
sendDigitalPortPair(byte pin, int value)
send digital ports as one int
sendSysex(byte command, byte bytec, byte* bytev)
send a command with an arbitrary array of bytes
sendString(const char* string)
send a string to the host computer
sendString(byte command, const char* string)
send a string to the host computer using a custom command type

Receiving Messages

available()
check to see if there are any incoming messages in the buffer
processInput()
process incoming messages from the buffer, sending the data to any registered callback functions
attach(byte command, callbackFunction myFunction)
attach a function to an incoming message type
detach(byte command)
detach a function from an incoming message type

Callback Functions

In order to attach your function to a message type, your function must match the standard callback function. There are currently three types of callback functions in Firmata: generic, string, and sysex.

generic
void callbackFunction(byte pin, int value);
system_reset
void systemResetCallbackFunction(void);
string
void stringCallbackFunction(char *myString);
sysex
void sysexCallbackFunction(byte pin, byte byteCount, byte *arrayPointer);

Message Types

These are the various message types that you can attach functions to.

ANALOG_MESSAGE
the analog value for a single pin
DIGITAL_MESSAGE
8-bits of digital pin data (one port)
REPORT_ANALOG
enable/disable the reporting of analog pin
REPORT_DIGITAL
enable/disable the reporting of a digital port
SET_PIN_MODE
change the pin mode between INPUT/OUTPUT/PWM/etc.
FIRMATA_STRING
C-style strings, uses stringCallbackFunction for the function type
SYSEX_START
generic, arbitrary length messages (via MIDI SysEx protocol), uses sysexCallbackFunction for the function type
SYSTEM_RESET
message to reset firmware to its default state, uses systemResetCallbackFunction for the function type

Example

This example shows how to send and receive analog messages using Firmata.

#include <Firmata.h>

byte analogPin;

void analogWriteCallback(byte pin, int value)
{
    pinMode(pin,OUTPUT);
    analogWrite(pin, value);
}

void setup()
{
    Firmata.setFirmwareVersion(0, 1);
    Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
    Firmata.begin();
}

void loop()
{
    while(Firmata.available()) {
        Firmata.processInput();
    }
    for(analogPin = 0; analogPin < TOTAL_ANALOG_PINS; analogPin++) {
        Firmata.sendAnalog(analogPin, analogRead(analogPin)); 
    }
}

Share