This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofArduino.h
Go to the documentation of this file.
79#define SCHEDULER_DATA 0x7B // send a createtask/deletetask/addtotask/schedule/querytasks/querytask request to the scheduler
195};
201};
212};
235};
247};
542 void sendStepperMove(int stepperID, int direction, int steps, int speed = 0, float acceleration = 0, float deceleration = 0);
561 void sendI2CWriteRequest(char slaveAddress, unsigned char * bytes, int numOfBytes, int reg = -1);
622 void sendOneWireWrite(int pin, std::vector<unsigned char> devices, std::vector<unsigned char> data);
638 void sendOneWireWriteAndRead(int pin, std::vector<unsigned char> devices, std::vector<unsigned char> data, int numBytesToRead);
639 void sendOneWireRequest(int pin, unsigned char subcommand, std::vector<unsigned char> devices, int numBytesToRead, unsigned char correlationId, unsigned int delay, std::vector<unsigned char> dataToWrite);
749 // maintains a history of received sysEx messages (excluding SysEx messages in the extended command set)
This is a way to control an Arduino that has had the firmata library loaded onto it,...
Definition ofArduino.h:273
void sendDigital(int pin, int value, bool force=false)
Definition ofArduino.cpp:287
void setDigitalHistoryLength(int length)
Definition ofArduino.cpp:183
void sendI2CWriteRequest(char slaveAddress, std::vector< char > bytes, int reg=-1)
void sendValueAsTwo7bitBytes(int value)
Send value as two 7 bit bytes.
Definition ofArduino.cpp:1058
void sendStepper2Wire(int dirPin, int stepPin, int stepsPerRev=200)
– stepper
Definition ofArduino.cpp:1150
void setAnalogHistoryLength(int length)
Definition ofArduino.cpp:189
void sendStepper4Wire(int pin1, int pin2, int pin3, int pin4, int stepsPerRev=200)
the pins has to have a stepper attached
Definition ofArduino.cpp:1184
void sendSysExBegin()
Sends the FIRMATA_START_SYSEX command.
Definition ofArduino.cpp:337
ofEvent< const Firmata_Stepper_Data > EStepperDataReceived
triggered when a stepper has finished rotating. Returns which stepper has complted its rotation
Definition ofArduino.h:496
void sendI2ContinuousReadRequest(char address, int numBytes, int reg=-1)
Initialize a continuous I2C read.
Definition ofArduino.cpp:1396
void sendOneWireDelay(int pin, unsigned int delay)
Tells firmata to not do anything for the passed amount of ms.
Definition ofArduino.cpp:1482
void setStringHistoryLength(int length)
Definition ofArduino.cpp:201
void sendOneWireAlarmsSearch(int pin)
Searches for 1-wire devices on the bus in an alarmed state.
Definition ofArduino.cpp:1447
ofEvent< const int > EInitialized
Triggered when the firmware version is received upon connect, the major firmware version is passed as...
Definition ofArduino.h:488
int getPwm(int pin) const
Returns the last set PWM value (0-255) for the given pin.
Definition ofArduino.cpp:256
void sendOneWireWriteAndRead(int pin, std::vector< unsigned char > devices, std::vector< unsigned char > data, int numBytesToRead)
Sends the passed data to the passed device on the bus, reads the specified number of bytes.
Definition ofArduino.cpp:1487
ofEvent< const int > EFirmwareVersionReceived
Triggered when a firmware version is received, the major version is passed as an argument.
Definition ofArduino.h:483
void serialClose(Firmata_Serial_Ports portID)
Close the specified serial port.
Definition ofArduino.cpp:1724
void sendOneWireSearch(int pin)
Searches for 1-wire devices on the bus.
Definition ofArduino.cpp:1443
void sendReset()
This will cause your Arduino to reset and boot into the program again.
Definition ofArduino.cpp:394
void sendDigitalPinMode(int pin, int mode)
Setting a pins mode to ARD_INPUT turns on reporting for the port the pin is on.
Definition ofArduino.cpp:412
std::map< int, supportedPinTypes > getPinCapabilities()
Definition ofArduino.h:704
ofEvent< const int > EDigitalPinChanged
Triggered when a digital pin changes value, the pin that changed is passed as an argument.
Definition ofArduino.h:471
void serialListen(Firmata_Serial_Ports portID)
For SoftwareSerial only. Only a single SoftwareSerial instance can read data at a time.
Definition ofArduino.cpp:1738
void sendOneWireWrite(int pin, std::vector< unsigned char > devices, std::vector< unsigned char > data)
Writes data to the bus to be received by the passed device.
Definition ofArduino.cpp:1478
ofEvent< const Firmata_I2C_Data > EI2CDataRecieved
triggered when the I2C bus returns data after a read request
Definition ofArduino.h:499
void sendSysExEnd()
Sends the FIRMATA_END_SYSEX command.
Definition ofArduino.cpp:341
void sendI2CReadRequest(char address, int numBytes, int reg=-1)
Asks the arduino to request bytes from an I2C device.
Definition ofArduino.cpp:1378
bool connect(const std::string &device, int baud=57600)
Opens a serial port connection to the arduino.
Definition ofArduino.cpp:159
void disconnect()
Closes the serial port connection. Does not turn the Arduino off.
Definition ofArduino.cpp:207
int getAnalogPinReporting(int pin) const
Definition ofArduino.cpp:499
void sendOneWireRequest(int pin, unsigned char subcommand, std::vector< unsigned char > devices, int numBytesToRead, unsigned char correlationId, unsigned int delay, std::vector< unsigned char > dataToWrite)
Definition ofArduino.cpp:1493
void sendI2CConfig(int delay)
Sends a I2C config request.
Definition ofArduino.cpp:1286
void serialWrite(Firmata_Serial_Ports port, unsigned char *bytes, int numOfBytes)
Write an array of bytes to the specified serial port.
Definition ofArduino.cpp:1693
void update()
Polls data from the serial port, this has to be called periodically.
Definition ofArduino.cpp:211
std::list< std::string > * getStringHistory()
Definition ofArduino.cpp:535
void sendServo(int pin, int value, bool force=false)
Send a value to a servo.
Definition ofArduino.cpp:1097
void sendServoAttach(int pin, int minPulse=544, int maxPulse=2400)
Definition ofArduino.cpp:1080
std::list< int > * getAnalogHistory(int pin)
Returns a pointer to the analog data history list for the given pin.
Definition ofArduino.cpp:512
int getValueFromTwo7bitBytes(unsigned char lsb, unsigned char msb)
Useful for parsing SysEx messages.
Definition ofArduino.cpp:1064
void sendStepperMove(int stepperID, int direction, int steps, int speed=0, float acceleration=0, float deceleration=0)
the pins has to have a stepper attached
Definition ofArduino.cpp:1238
void resetEncoderPosition(int encoderNum)
Definition ofArduino.cpp:1619
void sendString(std::string str)
Send a string to the Arduino.
Definition ofArduino.cpp:345
void sendSysEx(int command, std::vector< unsigned char > data)
Definition ofArduino.cpp:326
void sendByte(unsigned char byte)
Sends a byte without wrapping it in a firmata message.
Definition ofArduino.cpp:1052
void sendOneWireRead(int pin, std::vector< unsigned char > devices, int numBytesToRead)
Reads data from a device on the bus.
Definition ofArduino.cpp:1467
void sendSerialConfig(Firmata_Serial_Ports portID, int baud, int rxPin, int txPin)
Asks the Arduino to configure a hardware or serial port.
Definition ofArduino.cpp:1668
int getServo(int pin) const
Detaches a servo on a pin.
Definition ofArduino.cpp:1126
void serialStop(Firmata_Serial_Ports portID)
Stop continuous reading of the specified serial port.
Definition ofArduino.cpp:1716
ofEvent< const std::vector< Firmata_Encoder_Data > > EEncoderDataReceived
triggered when the encoder returns data after a read request
Definition ofArduino.h:502
int getDigitalPinMode(int pin) const
Get the pin mode of the given pin.
Definition ofArduino.cpp:280
void serialFlush(Firmata_Serial_Ports portID)
Flush the specified serial port.
Definition ofArduino.cpp:1731
void sendOneWireConfig(int pin, bool enableParasiticPower)
Configure the passed pin as the controller in a 1-wire bus.
Definition ofArduino.cpp:1427
ofEvent< const std::vector< unsigned char > > ESysExReceived
Triggered when a SysEx message that isn't in the extended command set is received,...
Definition ofArduino.h:479
ofEvent< const Firmata_Serial_Data > ESerialDataReceived
triggered when a Serial message is received. Returns which port and its data
Definition ofArduino.h:506
void sendAnalogPinReporting(int pin, int mode)
Definition ofArduino.cpp:398
void serialRead(Firmata_Serial_Ports port, int maxBytesToRead)
Start continuous reading of the specified serial port.
Definition ofArduino.cpp:1703
int getAnalog(int pin) const
Returns the analog in value that the pin is currently reading. because the Arduino has a 10 bit ADC y...
Definition ofArduino.cpp:224
std::list< int > * getDigitalHistory(int pin)
Returns a pointer to the digital data history list for the given pin.
Definition ofArduino.cpp:524
void sendOneWireReset(int pin)
Resets all devices on the bus.
Definition ofArduino.cpp:1473
void sendI2CWriteRequest(char slaveAddress, unsigned char *bytes, int numOfBytes, int reg=-1)
Asks the arduino to send an I2C request to a device.
Definition ofArduino.cpp:1296
ofEvent< const std::pair< int, Firmata_Pin_Modes > > EPinStateResponseReceived
Definition ofArduino.h:508
int getInvertedValueFromTwo7bitBytes(unsigned char lsb, unsigned char msb)
Definition ofArduino.cpp:1068
ofEvent< const std::string > EStringReceived
Triggered when a string is received, the string is passed as an argument.
Definition ofArduino.h:492
bool isInitialized() const
Returns true if a succesfull connection has been established and the Arduino has reported a firmware.
Definition ofArduino.cpp:551
ofEvent< const int > EAnalogPinChanged
Triggered when an analog pin changes value, the pin that changed is passed as an argument.
Definition ofArduino.h:475
std::list< std::vector< unsigned char > > * getSysExHistory()
Definition ofArduino.cpp:531
int getDigital(int pin) const
Returns the last received value (if the pin mode is ARD_INPUT) or the last set value (if the pin mode...
Definition ofArduino.cpp:241
Definition ofEvent.h:444
ofSerial provides a cross platform system for interfacing with the serial port. You can choose the po...
Definition ofSerial.h:113
Firmata_Serial_Ports
ids for hardware and software serial ports on the board
Definition ofArduino.h:238
Definition ofArduino.h:220
Definition ofArduino.h:214
Definition ofArduino.h:249
Definition ofArduino.h:226
Definition ofArduino.h:170