Right lets try this again, I've tried adding the heart rate code into the firmware code so that I still have full functionality of the bored though when I compile it I'm recieving an error message:[code]
/*
* Copyright (C) 2006 Free Software Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* See file LICENSE for further informations on licensing terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* ------------------------------
-----------------------------
* Firmata, the general purpose sensorbox firmware for Arduino
* -----------------------------------------------------------
*
* Firmata turns the Arduino into a Plug-n-Play sensorbox, servo
* controller, and/or PWM motor/lamp controller.
*
* It was originally designed to work with the Pd object [arduino]
* which is included in Pd-extended. This firmware is intended to
* work with any host computer software package. It can easily be
* used with other programs like Max/MSP, Processing, or whatever can
* do serial communications.
*
* @author: Hans-Christoph Steiner <
hans@at.or.at>
* help with initial protocol redesign: Jamie Allen <
jamie@heavyside.net>
* much protocol discussion: the Arduino developers mailing list
* key bugfixes: Georg Holzmann <
grh@mur.at>
* Gerda Strobl <
gerda.strobl@student.tugraz.at>
* @date: 2006-05-19
* @locations: STEIM, Amsterdam, Netherlands
* IDMI/Polytechnic University, Brookyn, NY, USA
* Electrolobby Ars Electronica, Linz, Austria
*/
/*
* TODO: add pulseOut functionality for servos
* TODO: add software PWM for servos, etc (servo.h or pulse.h)
* TODO: add device type reporting (i.e. some firmwares will use the Firmata
* protocol, but will only support specific devices, like ultrasound
* rangefinders or servos)
* TODO: use Program Control to load stored profiles from EEPROM
*/
/* cvs version: $Id: Pd_firmware.pde,v 1.29 2007/03/08 05:37:22 eighthave Exp $ */
/*==============================================================================
* MESSAGE FORMATS
*============================================================================*/
/* -----------------------------------------------------------------------------
* MAPPING DATA TO MIDI
*
* This protocol uses the MIDI message format, but does not use the whole
* protocol. Most of the command mappings here will not be directly usable in
* terms of MIDI controllers and synths. It should co-exist with MIDI without
* trouble and can be parsed by standard MIDI interpreters. Just some of the
* message data is used differently.
*
* MIDI format:
http://www.harmony-central.com/MIDI/Doc/table1.html *
* MIDI
* type command channel first byte second byte
* -----------------------------------------------------------------------------
* analog I/O 0xE0 pin # LSB(bits 0-6) MSB(bits 7-13)
* digital I/O 0x90 port base LSB(bits 0-6) MSB(bits 7-13)
* report analog pin 0xC0 pin # disable/enable(0/1) - n/a -
* report digital ports 0xD0 port base disable/enable(0/1) - n/a -
*
* digital pin mode(I/O) 0xF4 - n/a - pin # (0-63) pin state(0=in)
* firmware version 0xF9 - n/a - minor version major version
* system reset 0xFF - n/a - - n/a - - n/a -
*
*/
/* proposed extensions using SysEx
*
* type SysEx start command data bytes SysEx stop
* -----------------------------------------------------------------------------
* pulse I/O 0xF0 0xA0 five 7-bit chunks, LSB first 0xF7
* shiftOut 0xF0 0xF5 dataPin; clockPin; 7-bit LSB; 7-bit MSB 0xF7
*/
/* -----------------------------------------------------------------------------
* DATA MESSAGE FORMAT */
/* two byte digital data format
* ----------------------------
* 0 digital data, 0x90-0x9F, (MIDI NoteOn, but different data usage)
* 1 digital pins 0-6 bitmask
* 2 digital pins 7-13 bitmask
*/
/* analog 14-bit data format
* -------------------------
* 0 analog pin, 0xE0-0xEF, (MIDI Pitch Wheel)
* 1 analog least significant 7 bits
* 2 analog most significant 7 bits
*/
/* version report format
* Send a single byte 0xF9, Arduino will reply with:
* -------------------------------------------------
* 0 version report header (0xF9) (MIDI Undefined)
* 1 minor version (0-127)
* 2 major version (0-127)
*/
/* pulseIn/Out (uses 32-bit value)
* -------------------------------
* 0 START_SYSEX (0xF0) (MIDI System Exclusive)
* 1 pulseIn/Out (0xA0-0xAF)
* 2 bits 0-6 (least significant byte)
* 3 bits 7-13
* 4 bits 14-20
* 5 bits 21-27
* 6 bits 28-34 (most significant byte)
* 7 END_SYSEX (0xF7) (MIDI End of SysEx - EOX)
*/
/* shiftIn/Out (uses 8-bit value)
* ------------------------------
* 0 START_SYSEX (0xF0)
* 1 shiftOut (0xF5)
* 2 dataPin (0-127)
* 3 clockPin (0-127)
* 4 bits 0-6 (least significant byte)
* 5 bit 7 (most significant bit)
* 6 END_SYSEX (0xF7)
*/
/* -----------------------------------------------------------------------------
* CONTROL MESSAGES */
/* set digital pin mode
* --------------------
* 1 set digital pin mode (0xF4) (MIDI Undefined)
* 2 pin number (0-127)
* 3 state (INPUT/OUTPUT, 0/1)
*/
/* toggle analogIn reporting by pin
* --------------------------------
* 0 toggle digitalIn reporting (0xC0-0xCF) (MIDI Program Change)
* 1 disable(0)/enable(non-zero)
*/
/* toggle digitalIn reporting by port pairs
* ----------------------------------------
* 0 toggle digitalIn reporting (0xD0-0xDF) (MIDI Aftertouch)
* 1 disable(0)/enable(non-zero)
*/
/* request version report
* ----------------------
* 0 request version report (0xF9) (MIDI Undefined)
*/
/*==============================================================================
* MACROS
*============================================================================*/
/* Version numbers for the protocol. The protocol is still changing, so these
* version numbers are important. This number can be queried so that host
* software can test whether it will be compatible with the currently
* installed firmware. */
#define FIRMATA_MAJOR_VERSION 1 // for non-compatible changes
#define FIRMATA_MINOR_VERSION 0 // for backwards compatible changes
/* total number of pins currently supported */
#define TOTAL_ANALOG_PINS 6
#define TOTAL_DIGITAL_PINS 14
// for comparing along with INPUT and OUTPUT
#define PWM 2
// for selecting digital inputs
#define PB 2 // digital input, pins 8-13
#define PC 3 // analog input port
#define PD 4 // digital input, pins 0-7
#define MAX_DATA_BYTES 2 // max number of data bytes in non-SysEx messages
/* message command bytes */
#define DIGITAL_MESSAGE 0x90 // send data for a digital pin
#define ANALOG_MESSAGE 0xE0 // send data for an analog pin (or PWM)
//#define PULSE_MESSAGE 0xA0 // proposed pulseIn/Out message (SysEx)
//#define SHIFTOUT_MESSAGE 0xB0 // proposed shiftOut message (SysEx)
#define REPORT_ANALOG_PIN 0xC0 // enable analog input by pin #
#define REPORT_DIGITAL_PORTS 0xD0 // enable digital input by port pair
#define START_SYSEX 0xF0 // start a MIDI SysEx message
#define SET_DIGITAL_PIN_MODE 0xF4 // set a digital pin to INPUT or OUTPUT
#define END_SYSEX 0xF7 // end a MIDI SysEx message
#define REPORT_VERSION 0xF9 // report firmware version
#define SYSTEM_RESET 0xFF // reset from MIDI
/*==============================================================================
* GLOBAL VARIABLES
*============================================================================*/
/* input message handling */
byte waitForData = 0; // this flag says the next serial input will be data
byte executeMultiByteCommand = 0; // execute this after getting multi-byte data
byte multiByteChannel = 0; // channel data for multiByteCommands
byte storedInputData[MAX_DATA_BYTES] = {0,0}; // multi-byte data
/* digital pins */