| Home | Trees | Indices | Help |
|---|
|
|
This class contains the complete set of API methods that permit control of an Arduino Micro-Controller utilizing Firmata or its derivatives.
For information about the Firmata protocol, refer to: http://firmata.org/wiki/Protocol
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
HIGH = 1
|
|||
LOW = 0
|
|||
REPORTING_ENABLE = 1
|
|||
REPORTING_DISABLE = 0
|
|||
_command_deque = deque([])
|
|||
_command_handler = None
|
|||
_arduino = None
|
|||
_data_lock = threading.Lock()
|
|||
I2C_WRITE = 0
|
|||
I2C_READ = 8
|
|||
I2C_READ_CONTINUOUSLY = 16
|
|||
I2C_STOP_READING = 24
|
|||
I2C_READ_WRITE_MODE_MASK = 24
|
|||
TONE_TONE = 0
|
|||
TONE_NO_TONE = 1
|
|||
INPUT = None
|
|||
OUTPUT = None
|
|||
ANALOG = None
|
|||
PWM = None
|
|||
SERVO = None
|
|||
I2C = None
|
|||
TONE = None
|
|||
SONAR = None
|
|||
IGNORE = None
|
|||
ENCODER = None
|
|||
DIGITAL = None
|
|||
digital_output_port_pins =
|
|||
STANDARD_FIRMATA =
|
|||
NOT_SO_STANDARD_FIRMATA =
|
|||
|
|||
The constructor tries to connect to an Arduino or Arduino compatible running Firmata. If Firmata is not found on the Arduino, then we can optionally try to program the Arduino with the Firmata sketch
|
This routine instantiates the entire interface. It starts the operational threads for the serial interface as well as for the command handler.
|
Uses the Ino library to upload Firmata to the Arduino attached to the given serial port
|
Send an analog mapping query message via sysex. Client retrieves the results with a call to get_analog_mapping_request_results() |
Retrieve the last analog data value received for the specified pin.
|
Set the specified pin to the specified value.
|
Send a Firmata capability query message via sysex. Client retrieves the results with a call to get_capability_query_results() The Arduino can be rather slow in responding to this command. For the Mega 2560 R3 it has taken up to 25 seconds for a response. |
This method will close the transport (serial port) and exit
|
Retrieve the last digital data value received for the specified pin. NOTE: This command will return values for digital, pwm, etc, pin types
|
Set the specified pin to the specified value.
|
Disables analog reporting for a single analog pin.
|
Disables digital reporting. By turning reporting off for this pin, reporting is disabled for all 8 bits in the "port" -
|
Enables analog reporting. By turning reporting on for a single pin,
|
Enables digital reporting. By turning reporting on for all 8 bits in the "port" - this is part of Firmata's protocol specification.
|
This command enables the rotary encoder (2 pin + ground) and will enable encoder reporting. NOTE: This command is not currently part of standard arduino firmata, but is provided for legacy support of CodeShield on an Arduino UNO.
|
This method will send an extended data analog output command to the selected pin
|
A list is returned containing the latch state for the pin, the latched value, and the time stamp [pin_num, latch_state, latched_value, time_stamp] If the the latch state is LATCH_LATCHED, the table is reset (data and timestamp set to zero)
|
Call this method after calling analog_mapping_query() to retrieve its results
|
This method returns a list of lists representing the current pin mode and associated data values for all analog pins. All configured pin types, both input and output will be listed. Output pin data will contain zero.
|
Retrieve the data returned by a previous call to capability_query()
|
A list is returned containing the latch state for the pin, the latched value, and the time stamp [pin_num, latch_state, latched_value, time_stamp] If the the latch state is LATCH_LATCHED, the table is reset (data and timestamp set to zero)
|
This method returns a list of lists representing the current pin mode and associated data for all digital pins. All pin types, both input and output will be listed. Output pin data will contain zero.
|
Retrieve the firmata version information returned by a previous call to refresh_report_version()
|
Retrieve the firmware id information returned by a previous call to refresh_report_firmware()
|
This method returns the results of a previous call to pin_state_query() and then resets the pin state query data to None
|
Returns the PyMata version number in a list: [Major Number, Minor Number] |
Retrieve Ping (HC-SR04 type) data. The data is presented as a dictionary. The 'key' is the trigger pin specified in sonar_config() and the 'data' is the current measured distance (in centimeters) for that pin. If there is no data, the value is set to IGNORE (127).
|
NOTE: THIS METHOD MUST BE CALLED BEFORE ANY I2C REQUEST IS MADE This method initializes Firmata for I2c operations. It allows setting of a read time delay amount, and to optionally track the pins as I2C in the appropriate response table. To track pins: Set the pin_type to ANALOG or DIGITAL and provide the pin numbers. If using ANALOG, pin numbers use the analog number, for example A4: use 4.
|
This method requests the read of an i2c device. Results are retrieved by a call to i2c_get_read_data()
|
Write data to an i2c device.
|
This method stops an I2C_READ_CONTINUOUSLY operation for the i2c device address specified.
|
This method retrieves the i2c read data as the result of an i2c_read() command.
|
This method issues a pin state query command. Data returned is retrieved via a call to get_pin_state_query_results()
|
This method will call the Tone library for the selected pin. If the tone command is set to TONE_TONE, then the specified tone will be played. Else, if the tone command is TONE_NO_TONE, then any currently playing tone will be disabled. It is intended for a future release of Arduino Firmata
|
This method will query firmata for the report version. Retrieve the report version via a call to get_firmata_version() |
This method will query firmata to report firmware. Retrieve the report via a call to get_firmata_firmware_version() |
This command sends a reset message to the Arduino. The response tables will be reinitialized
|
This method "arms" an analog pin for its data to be latched and saved in the latching table
|
This method "arms" a digital pin for its data to be latched and saved in the latching table
|
This method sets a pin to the desired pin mode for the pin_type. It automatically enables data reporting. NOTE: DO NOT CALL THIS METHOD FOR I2C. See i2c_config().
|
This method sends the desired sampling interval to Firmata. Note: Standard Firmata will ignore any interval less than 10 milliseconds
|
Configure a pin as a servo pin. Set pulse min, max in ms.
|
Configure the pins, and ping interval for an HC-SR04 type device. Single pin configuration may be used. To do so, set both the trigger and echo pins to the same value. Up to a maximum of 6 SONAR devices is supported If the maximum is exceeded a message is sent to the console and the request is ignored. NOTE: data is measured in centimeters :param trigger_pin: The pin number of for the trigger (transmitter). :param echo_pin: The pin number for the received echo. :param ping_interval: Minimum interval between pings. Lowest number to use is 33 ms.Max is 127 |
|
|||
digital_output_port_pins
|
STANDARD_FIRMATA
|
NOT_SO_STANDARD_FIRMATA
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Mar 13 14:52:31 2014 | http://epydoc.sourceforge.net |