So I’ve been searching around for a bit and have found minimal threads to support me on this. I have an arduino uno that I used with a library created for speech recognition. The library uses softwareserial. I’ve now bought an arduino 33 IoT which uses hardwareserial and I didn’t know. The library no longer works and I really need the size and would really like to keep the onboard gyro capabilities of the 33 IoT instead of nano. Can anyone help me with figuring out how to change this library over to Hardware Serial! I reference this library into my custom sketch.
Library Link: https://electronoobs.com/images/Arduino/tut_165/VoiceRecognitionV3-master.zip
Github Link:VoiceRecognitionV3/VoiceRecognitionV3.h at master · elechouse/VoiceRecognitionV3 · GitHub
VoiceRecognitionV3.h Code:
#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
class VR : public SoftwareSerial{
public:
VR(uint8_t receivePin, uint8_t transmitPin);
static VR* getInstance() {
return instance;
}
typedef enum{
PULSE = 0,
TOGGLE = 1,
SET = 2,
CLEAR = 3
}io_mode_t;
typedef enum{
LEVEL0 = 0,
LEVEL1,
LEVEL2,
LEVEL3,
LEVEL4,
LEVEL5,
LEVEL6,
LEVEL7,
LEVEL8,
LEVEL9,
LEVEL10,
LEVEL11,
LEVEL12,
LEVEL13,
LEVEL14,
LEVEL15,
}pulse_width_level_t;
typedef enum{
GROUP0 = 0,
GROUP1,
GROUP2,
GROUP3,
GROUP4,
GROUP5,
GROUP6,
GROUP7,
GROUP_ALL = 0xFF,
}group_t;
int setBaudRate(unsigned long br);
int setIOMode(io_mode_t mode);
int resetIO(uint8_t *ios=0, uint8_t len=1);
int setPulseWidth(uint8_t level);
int setAutoLoad(uint8_t *records=0, uint8_t len = 0);
int disableAutoLoad();
int restoreSystemSettings();
int checkSystemSettings(uint8_t* buf);
int recognize(uint8_t *buf, int timeout = VR_DEFAULT_TIMEOUT);
int train(uint8_t *records, uint8_t len=1, uint8_t *buf = 0);
int train(uint8_t record, uint8_t *buf = 0);
int trainWithSignature(uint8_t record, const void *buf, uint8_t len=0, uint8_t *retbuf = 0);
int load(uint8_t *records, uint8_t len=1, uint8_t *buf = 0);
int load(uint8_t record, uint8_t *buf = 0);
int clear();
int setSignature(uint8_t record, const void *buf=0, uint8_t len=0);
int deleteSignature(uint8_t record);
int checkSignature(uint8_t record, uint8_t *buf);
int checkRecognizer(uint8_t *buf);
int checkRecord(uint8_t *buf, uint8_t *records = 0, uint8_t len = 0);
/** group control */
int setGroupControl(uint8_t ctrl);
int checkGroupControl();
int setUserGroup(uint8_t grp, uint8_t *records, uint8_t len);
int checkUserGroup(uint8_t grp, uint8_t *buf);
int loadSystemGroup(uint8_t grp, uint8_t *buf=0);
int loadUserGroup(uint8_t grp, uint8_t *buf=0);
int test(uint8_t cmd, uint8_t *bsr);
int writehex(uint8_t *buf, uint8_t len);
/***************************************************************************/
/** low level */
int len(uint8_t *buf);
int cmp(uint8_t *buf, uint8_t *bufcmp, int len );
void cpy(char *buf, char * pbuf);
void sort(uint8_t *buf, int len);
int cleanDup(uint8_t *des, uint8_t *buf, int len);
void send_pkt(uint8_t *buf, uint8_t len);
void send_pkt(uint8_t cmd, uint8_t *buf, uint8_t len);
void send_pkt(uint8_t cmd, uint8_t subcmd, uint8_t *buf, uint8_t len);
int receive(uint8_t *buf, int len, uint16_t timeout = VR_DEFAULT_TIMEOUT);
int receive_pkt(uint8_t *buf, uint16_t timeout = VR_DEFAULT_TIMEOUT);
/***************************************************************************/
private:
static VR* instance;
};