I'm trying to change the original SoftwareSerial library from VR3 Voice Recognition Module to a HardwareSerial one... I don't have any knowlodge of how libraries works... I Tried to make some these changes, but without sucess.
I changed VoiceRecognitionV3.H file from this
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "wiring_private.h"
#include "SoftwareSerial.h"
#include <avr/pgmspace.h>
#define DEBUG
#ifdef DEBUG
#define DBGSTR(message) Serial.print(message)
#define DBGBUF(buf, len) Serial.write(buf, len)
#define DBGLN(message) Serial.println(message)
#define DBGFMT(msg, fmt) Serial.print(msg, fmt)
#define DBGCHAR(c) Serial.write(c)
#else
#define DBG(message)
#endif // DEBUG
to this
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "wiring_private.h"
//#include "SoftwareSerial.h" // Commented this #include
#include <avr/pgmspace.h>
#define DEBUG
#ifdef DEBUG
#define DBGSTR(message) Serial3.print(message) // Change to Serial3.*
#define DBGBUF(buf, len) Serial3.write(buf, len) // Change to Serial3.*
#define DBGLN(message) Serial3.println(message) // Change to Serial3.*
#define DBGFMT(msg, fmt) Serial3.print(msg, fmt) // Change to Serial3.*
#define DBGCHAR(c) Serial3.write(c) // Change to Serial3.*
#else
#define DBG(message)
#endif // DEBUG
I changed VoiceRecognitionV3.CPP file from this
#include "VoiceRecognitionV3.h"
#include <string.h>
VR* VR::instance;
/** temp data buffer */
uint8_t vr_buf[32];
uint8_t hextab[17]="0123456789ABCDEF";
/**
@brief VR class constructor.
@param receivePin --> software serial RX
transmitPin --> software serial TX
*/
VR::VR(uint8_t receivePin, uint8_t transmitPin) : SoftwareSerial(receivePin, transmitPin)
{
instance = this;
SoftwareSerial::begin(38400);
}
to this
#include "VoiceRecognitionV3.h"
#include <string.h>
VR* VR::instance;
/** temp data buffer */
uint8_t vr_buf[32];
uint8_t hextab[17]="0123456789ABCDEF";
/**
@brief VR class constructor.
@param receivePin --> software serial RX
transmitPin --> software serial TX
*/
VR::VR(uint8_t receivePin, uint8_t transmitPin) : HardwareSerial(receivePin, transmitPin) // Changed to HardwareSerial
{
instance = this;
HardwareSerial::begin(38400); // Changed to HardwareSerial
}
My ino code is basicly
#include "VoiceRecognitionV3.h"
VR myVR(15, 14); // (COMANDO DE VOZ) Hardware pins in Arduino MEGA Board
void Setup()
{
myVR.begin(9600); // Start module serial
myVR.clear(); // Start the module
}
void loop()
{
// my code
}
I'm getting this small error output from Arduino IDE
D:\...\VoiceRecognitionV3.cpp: In constructor 'VR::VR(uint8_t, uint8_t)':
D:\...\VoiceRecognitionV3.cpp:43:89: error: no matching function for call to 'HardwareSerial::HardwareSerial(uint8_t&, uint8_t&)'
VR::VR(uint8_t receivePin, uint8_t transmitPin) : HardwareSerial(receivePin, transmitPin)
^
D:\...\VoiceRecognitionV3.cpp:43:89: note: candidates are:
In file included from C:\.../Arduino.h:232:0,
from D:\...\VoiceRecognitionV3.h:31,
from D:\...\VoiceRecognitionV3.cpp:29:
C:\.../HardwareSerial.h:117:12: note: HardwareSerial::HardwareSerial(volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*, volatile uint8_t*)
inline HardwareSerial(
^
C:\.../HardwareSerial.h:117:12: note: candidate expects 6 arguments, 2 provided
C:\.../HardwareSerial.h:93:7: note: constexpr HardwareSerial::HardwareSerial(const HardwareSerial&)
class HardwareSerial : public Stream
^
C:\.../HardwareSerial.h:93:7: note: candidate expects 1 argument, 2 provided
C:\.../HardwareSerial.h:93:7: note: constexpr HardwareSerial::HardwareSerial(HardwareSerial&&)
C:\.../HardwareSerial.h:93:7: note: candidate expects 1 argument, 2 provided
Voice Recognition Library Download
Board Arduino MEGA 2560