0

Metro M0 Express and BitVoicer
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Metro M0 Express and BitVoicer

by RBittles on Fri Nov 01, 2019 8:32 pm

Hello all,

I am a graduate student in a physical computing course, and I am new to microprocessors (not new to programming). We have been given an assignment and I want to incorporate voice recognition with the neopixel ring with some basic commands. I purchased BitVoicer from BitSophia for 5 bucks, and tried to follow the online tutorial.

When I attempt to compile sample code as seen in use with an Ardiono Uno. I get some errors. When I switch the board in my Arduino IDE to an Uno, it compiles without a hitch. I can get an Arduino Uno, if I must, but the rest of the class is using the Metro Express, and I would like to stick with that microprocessor.

I tried reaching out to the company, but haven't heard back, nor do I expect to. It turns out that the guy who created the tutorial is the guy who got my 5 bucks through PayPal. Meh, no big loss.

Here is the sample code:

Code: Select all | TOGGLE FULL SIZE
//Imports the BitVoicer library to the sketch
#include <BitVoicer11.h>
//Instantiates the BitVoicerSerial class
BitVoicerSerial bvSerial = BitVoicerSerial();
//Stores the data type retrieved by getData()
byte dataType = 0;
//Stores the state of pin 4
byte pinVal = 0;
//Stores true if the Audio Streaming Calibration tool
//is running
boolean sampleTest = false;
void setup()
{
  //Sets the analog reference to external (AREF pin)
  //WARNING!!! If anything is conected to the AREF pin,
  //this function MUST be called first. Otherwise, it will
  //damage the board.
  bvSerial.setAnalogReference(BV_EXTERNAL);
  //Sets up the microcontroller to perform faster analog reads
  //on the specified pin
  bvSerial.setAudioInput(0);
  //Starts serial communication at 115200 bps
  Serial.begin(115200);
  //Sets digital pin 4 as OUTPUT
  pinMode(4, OUTPUT);
  //Turns off pin 4
  digitalWrite(4, pinVal);
}
void loop()
{
  //Captures audio and sends it to BitVoicer if the Audio
  //Streaming Calibration Tool is running
  if (sampleTest == true)
  {
    //The value passed to the function is the time
    //(in microseconds) that the function has to wait before
    //performing the reading. It is used to achieve about
    //8000 readings per second.
    bvSerial.processAudio(46);
  }
 
  //Captures audio and sends it to BitVoicer if the Speech
  //Recognition Engine is running
  if (bvSerial.engineRunning)
  {
    //The value passed to the function is the time
    //(in microseconds) that the function has to wait before
    //performing the reading. It is used to achieve about
    //8000 readings per second.
    bvSerial.processAudio(46);
  }
 
  //Updates the pin 4 state on every loop
  digitalWrite(4, pinVal);
}
//This function runs every time serial data is available
//in the serial buffer after a loop
void serialEvent()
{
  //Reads the serial buffer and stores the received data type
  dataType = bvSerial.getData();
 
  //Changes the value of sampleTest if the received data was
  //the start/stop sampling command
  if (dataType == BV_COMMAND)
    sampleTest = bvSerial.cmdData;
 
  //Signals BitVoicer's Speech Recognition Engine to start
  //listening to audio stream after the engineRunning status
  //was received
  if (dataType == BV_STATUS && bvSerial.engineRunning == true)
    bvSerial.startStopListening();
 
  //Checks if the data type is the same as the one in the
  //Voice Schema
  if (dataType == BV_BYTE)
  {
    //Checks the value stored in byteData by getData() and
    //changes the pin value
    if (bvSerial.byteData == 0)
      pinVal = LOW;
    else
      pinVal = HIGH;
  }
}


and here are the error messages:

Code: Select all | TOGGLE FULL SIZE
Arduino: 1.8.10 (Windows 10), Board: "Adafruit Metro M0 Express, Arduino, Off"

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp: In member function 'void BitVoicerSerial::processAudio(unsigned int)':

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:202:7: error: 'ADCSRA' was not declared in this scope

   sbi(ADCSRA, ADSC);

       ^~~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:202:7: note: suggested alternative: 'CDC_RX'

   sbi(ADCSRA, ADSC);

       ^~~~~~

       CDC_RX

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:202:15: error: 'ADSC' was not declared in this scope

   sbi(ADCSRA, ADSC);

               ^~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:202:15: note: suggested alternative: 'ADC'

   sbi(ADCSRA, ADSC);

               ^~~~

               ADC

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:202:3: error: 'sbi' was not declared in this scope

   sbi(ADCSRA, ADSC);

   ^~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:204:10: error: 'bit_is_set' was not declared in this scope

   while (bit_is_set(ADCSRA, ADSC));

          ^~~~~~~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:204:10: note: suggested alternative: 'timerisset'

   while (bit_is_set(ADCSRA, ADSC));

          ^~~~~~~~~~

          timerisset

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:206:16: error: 'ADCH' was not declared in this scope

   Serial.write(ADCH);

                ^~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:206:16: note: suggested alternative: 'ADC'

   Serial.write(ADCH);

                ^~~~

                ADC

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp: In member function 'void BitVoicerSerial::setAudioInput(uint8_t)':

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:228:3: error: 'ADMUX' was not declared in this scope

   ADMUX = ((_bvAnalogReference << 5) | (pin & 0x07));

   ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:232:7: error: 'ADCSRA' was not declared in this scope

   sbi(ADCSRA, ADPS2);

       ^~~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:232:7: note: suggested alternative: 'CDC_RX'

   sbi(ADCSRA, ADPS2);

       ^~~~~~

       CDC_RX

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:232:15: error: 'ADPS2' was not declared in this scope

   sbi(ADCSRA, ADPS2);

               ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:232:15: note: suggested alternative: 'SAM4S2'

   sbi(ADCSRA, ADPS2);

               ^~~~~

               SAM4S2

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:232:3: error: 'sbi' was not declared in this scope

   sbi(ADCSRA, ADPS2);

   ^~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:233:15: error: 'ADPS1' was not declared in this scope

   sbi(ADCSRA, ADPS1);

               ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:234:15: error: 'ADPS0' was not declared in this scope

   cbi(ADCSRA, ADPS0);

               ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:234:3: error: 'cbi' was not declared in this scope

   cbi(ADCSRA, ADPS0);

   ^~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp: In member function 'void BitVoicerSerial::undoAudioInput()':

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:240:3: error: 'ADMUX' was not declared in this scope

   ADMUX = 0x00;

   ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:241:7: error: 'ADCSRA' was not declared in this scope

   sbi(ADCSRA, ADPS2);

       ^~~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:241:7: note: suggested alternative: 'CDC_RX'

   sbi(ADCSRA, ADPS2);

       ^~~~~~

       CDC_RX

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:241:15: error: 'ADPS2' was not declared in this scope

   sbi(ADCSRA, ADPS2);

               ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:241:15: note: suggested alternative: 'SAM4S2'

   sbi(ADCSRA, ADPS2);

               ^~~~~

               SAM4S2

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:241:3: error: 'sbi' was not declared in this scope

   sbi(ADCSRA, ADPS2);

   ^~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:242:15: error: 'ADPS1' was not declared in this scope

   sbi(ADCSRA, ADPS1);

               ^~~~~

C:\Users\Render\Documents\Arduino\libraries\BitVoicer11\BitVoicer11.cpp:243:15: error: 'ADPS0' was not declared in this scope

   sbi(ADCSRA, ADPS0);

               ^~~~~

Multiple libraries were found for "BitVoicer11.h"
 Used: C:\Users\Render\Documents\Arduino\libraries\BitVoicer11
exit status 1
Error compiling for board Adafruit Metro M0 Express.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


I can post the .h and .cpp files for BitVoicer11 if you think I need to. They make reference to Arduino.h and wiring_private.h. I went down a major rabbit hole trying to discover if I was missing a file somewhere.

I even completely uninstalled and reinstalled the Arduino IDE, and reinstalled my Boards and libraries according to the instructional on the Adafruit site.

Any help or information would be greatly appreciated. Also, if the problem is a board compatibility issue, any recommendations for an alternative voice recognition software package that works with my M0 Express would be cool. If I don't hear back, I'll probably just go get an Uno.

Thanks, in advance!

RBittles
 
Posts: 1
Joined: Fri Nov 01, 2019 7:50 pm

Please be positive and constructive with your questions and comments.