Community Question

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
Gunner
Commented October 2012
@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 :) 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
DJ Sures
Commented October 2012
Ah i see the MP3 Trigger command has a bug :) I will have that fixed asap. Thanks Neil!
DJ Sures
Commented October 2012
Latest release addresses the mp3TriggerPlayTrack() issue :)
Dave Schulpius
Commented October 2012
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
Dave Schulpius
Commented October 2012
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
Question
AvatarDave Schulpius
Asked on Sunday, October 28, 2012