Speech Recognition Seems Broken After Adding 2nd Board (or Update?).

 
#1

Today after I downloaded the latest update I tried to make a change in my Speech Recognition entrees and it would not let me save anything. When I tried to save I got the message "Santax error: This command requires 3 or 4 parameters. You passed 3". Not sure if the update is the cause but this is when I first noticed it.

Also I cant get any command to start that's listed in the Speech Recognition entree section. I see the phrase typed out in the little window after I speak it so I know it hears me but nothing happens. I can start the different controls myself (MP3 trigger, scripts, turn on and off ports) but the SR wont start them.

As far as I know I didn't change any of the command formatting. Here's a couple phrases with the command after it:

Danger Will Robenson - ControlCommand("Will Robenson", scriptstart)
Two steps forward my mechanical friend - MP3TriggerPlayTrack( d0, 38400, 5)

In addition to this, Friday I just added a second EZ-B board to my project. Maybe that had something to do with the above problem? Along with this I'm also started having a problem with the script I copied from DJ's examples; "motor & potentiometer" not showing $adcCurrent info in the "Variable Watch" panel. I have a pot hooked up to a DC motor that is controlled by an H-Bridge. This script was also working before I added the second board and moved this set up to the new board. Before the move the values in that window would move from 10 to 200 depending where I turned the pot to and it turned on and off ports properly. It now shows 1.0, the value wont move, and only one port will turn on and stay on. It could be just me not knowing the proper place to show the script where to look for the ADC port but I just don't know.

I have a post about the Pot & Motor problem in the EZ Builder category. It has a copy of my script. Look here: http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=2134

Also I have a copy of my project in the EZ-Cloud section titled "B9 Robot Control 1" if you'd like to look it over.

Thanks for any help,
Dave Schulpius

#2

There are no errors using speech recognition. Check your project and fix any errors that are reported.

#3

I don't understand why I'd get this error message "Santax error: This command requires 3 or 4 parameters. You passed 3" when I try to save in the speech recognition panel. After looking closely at all the entries I made I clearly only have 3 parameters in each. The only two that are different are two entries that start scripts.

I started a new project with just the speech recognition control and the MP3 Trigger control and had the same result just after making one entry. I can trigger files with the MP3 trigger control and still cant save anything while getting the above error. This will also happen on two different laptops. I did save the projects to the EZ-Cloud and open them from there on each laptop.

Thanks for the help, Dave Schulpius

#4

I just tried a simple bit of speech recognition and I cut and pasted your 1st command

Danger Will Robenson - ControlCommand("Will Robenson", scriptstart)

That worked fine no syntax errors

However

Two steps forward my mechanical friend - MP3TriggerPlayTrack( d0, 38400, 5)

This doesn't seem to work and returns a syntax (the same as you had) error unless you add a speech recognition pause

MP3TriggerPlayTrack( d0, 38400, 5, 2000)

So the MP3 Trigger command has a bug (well sort of) just add the pause parameter. Perhaps the example given in the EZ-B sript needs modifying

MP3TriggerPlayTrack( digitalPort, baud, trackNumber, [pause time] )
Plays the specified MP3 track from the MP3 Trigger Sheild
Optionally, the Pause Time value can be used which disables the Speech Recognition control for the specified number of milliseconds.
Example: MP3TriggerPlayTrack( d0, 38400, 1 )
Example: MP3TriggerPlayTrack( d0, 38400, 1, 3000 )


Speech recognition works fine

Neil

#5

Ahh! Thanks! That did it. I added the Pause time value to each of my entries and now everything works nicely. Not only did I have to do this in the Speech Recognition panel but in all the other scripts that called the MP3 Trigger to play a file. Without modifying those other scripts, they would not run. Thanks again!

Now I just need to find the proper coding in EZ Builder to GET the ADC value from the second EZ-B board that's hooked up to a potentiometer for h-bridge control. I know I need to place a 1. In the code somewhere but I cant seem to find the proper place. Here's a line of code from a script that DJ provided for this function and works nice if the pot is attached to the first board:

$adcCurrent = GetADC(adc0)

Any ideas or suggestions?

Many thanks again,
Dave Schulpius

#6

@dschulpius I found this in the Script Help sidebar of EZ-Script... down near the bottom. Is this what you need?

Multiple EZ-B Boards
EZ-Builder supports multiple physical EZ-B Boards connected to your computer. You can specify the board by putting the board number in front of the command. For example: 2.Servo(d0, 8) will move the D0 servo on EZ-B board #2 to position 8. If no board is specified, the first board (zero) is assumed. If using more than one board, the first board is always responsible for Movement Panels.


Thus you need either:

1.$adcCurrent = GetADC(adc0)

or

$adcCurrent = 1.GetADC(adc0) <--Probably this one; I don't have a 2nd board to test with Smile but I can't see the reason for specifying a board number to a variable.

This is assuming the boards start count at 0 as listed on the Connect Panel... thus 2nd board is #1

#7

Ah i see the MP3 Trigger command has a bug Smile I will have that fixed asap. Thanks Neil!

#8

Latest release addresses the mp3TriggerPlayTrack() issue Smile

#9

Thanks DJ. Amazing! A bug fix in one day! Wow.

As far as the variable code for my Pot controlled H-Bridge I cant gat the syntax to work with the second board. The rest of the script seems to be working nicely. The script runs and the port turns on but I get no return value from the ADC port.

I entered this syntax in this script and then I do see the proper values in need in the scripts window:
1.GetADC(adc0)
The value changes as it should as I turn the pot. It goes from 0 - 200.

However when I remove that syntax and insert this other syntax the variable holds at 1.0:
$adcCurrent = 1.GetADC(adc0)
Moveing around the "1." does nothing.

Could this be a bug? Like I said before; This script works nicely on the first board but if I add the "1." to run it on the second board I can not get it to read the ADC the pot it's attached to:

**************************************************************************

# This script will move an HBridge to
# the specified ADC value.

if ($adcSpecified = 0)
goto(Error)

:Start

$adcCurrent = 1.GetADC(adc0)

1.if ($adcCurrent > $adcSpecified)
goto(RotateLeft)

1.if ($adcCurrent < $adcSpecified)
goto(RotateRight)

1.if ($adcCurrent = $adcSpecified)
goto(RotateStop)

goto(Start)

:RotateLeft
1.PWM(D2,60)
1.Set(d1, off)
1.Set(d0, on)
1.Return()

:RotateRight
1.PWM(D2,60)
1.Set(d1, on)
1.Set(d0, off)
1.Return()

:RotateStop
1.Set(d1, off)
1.Set(d0, off)
1.Halt()

:Error
Say("There is no specified position to move too")
**********************************************************************
Here are the call scripts:

********
# This script will move the motor into the
# right position

$adcSpecified = 200
ControlCommand("Hips", scriptStart)
**************************************
# This script will move the motor into the
# left position

$adcSpecified = 60
ControlCommand("Hips", scriptStart)
*************************************

Thanks for looking, any help is welcomed,
Dave Schulpius

#10

Ahh! Today's update fixed my problem. Now EZ-B supports Variable assignment and IF conditioning across multiple EZ-B boards. Now I don't have to run cables from the top of my robot, 4 foot to the bottom just to get to the first board's ADC ports! Everything is right in my world and working good.

I did have to modify DJ's Motor & Potentiometer Script example in EZ Builder to get my setup to work properly. For some reason the motor just shot past the $adcSpecified value sent to the main script by the call script. Maybe it's the pot I'm using. Anyway the value returned by the ADC port seemed to lag and the motor would not stop when it got to the value it was looking for. This line controls the stop command:

if ($adcCurrent = $adcSpecified)
goto(RotateStop)

I had to change the = in the above syntax to either a > or $adcSpecified)
goto(RotateStop)

goto(Start)

:RotateRight
1.PWM(D2, 100)
1.Set(d1, on)
1.Set(d0, off)
Return()

:RotateStop
1.Set(d1, off)
1.Set(d0, off)
Halt()

:Error
Say("There is no specified position to move too")
************************************************
************************************************

#Call Script for the motor to move left:

# This script will move the motor into the
# left position

$adcSpecified = 95
ControlCommand("you script name here", scriptStart)

************************************************

#Main script for the motor to move Left:

# This script will move an HBridge to
# the specified Left ADC value.

if ($adcSpecified = 0)
goto(Error)

:Start

1.$adcCurrent = GetADC(adc0)

if ($adcCurrent > $adcSpecified)
goto(RotateLeft)

if ($adcCurrent < $adcSpecified)
goto(RotateStop)

goto(Start)

:RotateLeft
1.PWM(D2,40)
1.Set(d1, off)
1.Set(d0, on)
Return()

:RotateStop
1.Set(d1, off)
1.Set(d0, off)
Halt()

:Error
Say("There is no specified position to move too")
**************************************************88

Hope this helps someone. If anyone sees a better way please speak up but this is working nicely for me.

Thanks to everyone who helped me with this and to DJ for his quick fixes!

Keep having fun,
Dave Schulpius