Go Down

Topic: Arduino Uno - error msg: expected initializer before 'bridge' - plus another sim (Read 2 times) previous topic - next topic

dayo30

Using EasyVR, I got a program off the internet, to turn an LED off, and on, with voice commands.
Compiling gave many error messages, and I was able to correct them all, except the following two:

- expected initilalizer before 'bridge'

- In function 'void setup()': 'bridge was not declared in this scope

Code: [Select]


#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#endif

  #include "EasyVR.h"

EasyVR easyvr(port);

//Groups and Commands
enum Groups

  GROUP_0 = 0,
GROUP_1 = 1,
}

enum Group0
{
  G0_ARDUINO = 0,
}

enum Group1
{
  G1_LED_AN = 0,
G1_LED_AUS = 1,
}

EasyVRBridge bridge;
int8_t group, idx;

void setup()
{
  // bridge mode?
if (bridge.check())



I have searched in the forum for "expected initializing before ..." and found nothing helpful but,
as I am new to this, I may easily have overlooked something.

Any suggestions appreciated.
Thanks,
Don Oliver

GDV0

Hi,
There is a library dedicated to EasyVR and in this library 2 classes are defined
- EasyVR and
- EasyVRBridge

Therefore you have to include the file EasyVRBridge.h and
add create the object bridge with the following line:
EasyVRBridge bridge;

Take care as I'm not familiar with this library, maybe additional parameters are needed

Hope this will help


dxw00d

You don't have semicolons on your enum statements.

Code: [Select]
enum Groups

  GROUP_0 = 0,
GROUP_1 = 1,
}

enum Group0
{
  G0_ARDUINO = 0,
}

enum Group1
{
  G1_LED_AN = 0,
G1_LED_AUS = 1,
}

dayo30


Hi,
There is a library dedicated to EasyVR and in this library 2 classes are defined
- EasyVR and
- EasyVRBridge

Therefore you have to include the file EasyVRBridge.h and
add create the object bridge with the following line:
EasyVRBridge bridge;

Take care as I'm not familiar with this library, maybe additional parameters are needed

Hope this will help



Thanks for your answer.
Two things:
- I included EasyVRBridge.h, and still get the same error message.
- TestEasyVR.pde does not include this file, and works perfectly

Don

dayo30


You don't have semicolons on your enum statements.

Code: [Select]
enum Groups

  GROUP_0 = 0,
GROUP_1 = 1,
}

enum Group0
{
  G0_ARDUINO = 0,
}

enum Group1
{
  G1_LED_AN = 0,
G1_LED_AUS = 1,
}




I don't believe that semicolons are required after enum statements, at least, in the examples that I have seen???

Thanks, Don

Go Up