The easiest way to program the most powerful robots.
Use technologies by leading industry experts.
ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.
@Nomad,888Edit*** It means you have not added a $SoundValue in the Sound Servo. in rich's example he has soundvaule you should have $SoundValue in the variable name in the Sound servo config.
so the led works when i speak into a headset mic.i can see jd mouthled lid up. but thats not the effect am looking for.am looking for the led to lid up when jd speaks .
@Norman, I do not have a JD so I don't know, but... Am guessing you are using the built in speaker on the EZB controoller. Use the servo Servo (EZB Playback) not the Sound Servo.
If so just change the variable name from $soundvalue to $Soundv4Value in your script.
Here is something different I did to experiment. I added the Sound servo (PC Speaker), which gives me the variable $soundvalue for anything that is played through my computers speakers. I don't actually use it for controlling a servo, I just wanted it to detect the PC speaker sound output.
I then used my RGB animiator display in my JD (Spock) and created 3 different static display for a KITT (Knight Rider) type voice display (the 3x3s don't make a good KITT display, but that's not important.
I just wanted to see if I could use the Sound servo PC to make the RGB "dance" to music and I can.
If the value is less than 10, I set the display to blank. Kitt1, Kitt2 and Kitt2 represent brightness levels for my animation display pattern.
I have commented out the Print values, those were for testing and debugging and I would recommend anyone use those to test their scripts so they can see what Sound servo controls are responding too.
What I have not adjusted yet are the Update Speed and Scalar under the Sound Settings of the Sound servo control. As anyone played with those setting much? I'd like to improve the rate the my RGB display changes state to the sound level.
Hi old friend. Nice and interesting work. Well done. You taught me something today. What fun!
I think what you meant to say is that you posted your project and not that you made a plug in. No worries. Language barriers suck. LOL. If you did make a plugin where can I find it?
That method via the script that I demonstrated and you also demonstrated is one way to do it. I think that is the best or perhaps only way to get it do it natively on the fly or as any audio plays from the PC. Refining it to make it perfect is hard, which is probably why a lot of people use an outside audio controller.
But if you have preset sound files pre-recorded, I think the other way is to add an audio track to an EZBv4 Sound Board (PC sound board does not have the option for edit) and use the Edit function as The Robot Program shows in Episode 034 just like making DJ dance you can alter it to make the RGB animations "dance":
i am tinkering with the sound servo again.there is one thing i notest. when you speed up the sound servo,it just go's slower.is it possible , to ad more settings in the sound servo list for speed? like excample 0.75 0.50 0.25 will that speed up the sound servo?
My LED (which is NOT infrared, I can actually SEE it flashing now) doesn't blink on and off, but instead blinks between varying levels of brightness, and then it just stays at a lower level before the EZB is finished talking. I have its Speech Synthesis control saying "The answer to the ultimate question of life, the universe, and everything is 42.", but the Sound servo cuts out just after the "everything".
Is it supposed to be doing this, or is there some variable I'm missing?
...I'm sorry, I didn't know that we were supposed to stay in "our" topics. We figured out where I was messing up, I got myself some new LEDs, and now I'm looking for help on a different problem. Should I not have tried to look for help where that problem is being discussed?
original post "talk servo" - I use these settings, I am using D0 - you an use any port number, just connect your LED
make sure you connect you LED:
1) Connect the LED's Anode (+) (long side) wire to the signal (white) pin D0 of the EZ-B.
2) Connect the LED's Cathode (-) (short side) wire to the ground (black) pin D0 of the EZ-B.
Make sure you put the min 1 and the max 180
I made a coffee time script: - you can make any script.
SayWait("Good morning my robot crew.") sleep(60) SayWait("Are you just waking up.") sleep(60) SayWait("now that you are up.") sleep(60) SayWait("time for coffee.") sleep(60) SayWait("coffee time.") sleep(60) SayWait("come and get your 1st cup of coffee.") sleep(60) SayWait("so we can start this day.") sleep(60)
another way to use the "talk servo" - I used my "talk servo" here"
The Talk servo isn't working because I can't get it to turn off when the EZB isn't saying anything.
Why does the Sound servo only kinda-sorta work with the Speech Synthesis control, but not at all with the Bing Speech Recognition? (The Talk servo seems to work(ish) with Bing.)
In either case, the LED's too dim to see unless the robot's in total darkness (and yes, I'm using LEDs which emit VISIBLE light, not infrared).
I don't understand the first question. Which windows are you talking about? Are you implying that using multiple windows it hindering what I'm trying to accomplish, or is there something else I should be using that I'm not?
Hang on... Sound MIC script? Did you mean to ask where my script for the Sound servo is? Because I do have that in my controls, I just didn't think I needed to include that in the screengrab for the purposes of this video. This original tutorial said to have a script for the Sound Servo, but are you saying I need a script for the Sound Mic too/instead?
# wait some time for the pwm to do its ramping thing sleep(1000)
#set LED Off pwm(d0, 0)
# wait some time for the pwm to do its ramping thing sleep(1000)
goto(loop)
Here is a script that syncs with words and shuts off after each sentence.
SayEZBWait("Good evening.") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("Almost time for dinner.") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("Are you hungry?") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("What are we having?.") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("some thing lite I hope.") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("I am still full from lunch.") pwm(d0, 0) sleep(1000) pwm(d0, 0) SayEZBWait("have a great day.") pwm(d0, 0)
I do notice I have to disconnect and connect sometimes
for led you need only the window servo mic and this script .
# Sound servo to PWM range Script # Author: Rich # Version: 1.0.0 # Date: 25th June 2013
# Variables (do not adjust) # $soundright = auto $pwmvalue = 0
# Main script # Set the start point for the never ending loop :loop # Check the variable from the Sound servo control against a list of pre-determined levels (you may need to change these) and set the PWM value to suit. if ($soundright < 10) $pwmvalue = 0 ELSEif ($soundright < 20) $pwmvalue = 10 ELSEif ($soundright < 30) $pwmvalue = 20 ELSEif ($soundright < 40) $pwmvalue = 30 ELSEif ($soundright < 50) $pwmvalue = 40 ELSEif ($soundright < 60) $pwmvalue = 50 ELSEif ($soundright < 70) $pwmvalue = 60 ELSEif ($soundright < 80) $pwmvalue = 70 ELSEif ($soundright < 90) $pwmvalue = 80 ELSEif ($soundright < 100) $pwmvalue = 90 ELSE $pwmvalue = 100 endif
# Set the PWM with the value chosen above (you may need to change the port to suit) PWM(D1, $pwmvalue) PWM(D0, $pwmvalue) # Add any other PWM ports above this line with PWM(PortNo, $pwmvalue)
# Sleep for 100ms to avoid saturation (you may need to adjust this to increase accuracy or increase stability. Reduce the delay for better accuracy, increase for better stability) Sleep(100)
Yes, I'm aware that you've shown me several ways to do this. If "just following the instructions" was all I had to do, I wouldn't be here. Something is going wrong here, and I promise you, it isn't my being difficult for the sake of being difficult.
I followed these new instructions you gave me, and I'm still running into the same problems as before; the LED's just barely flickering at random, and it doesn't turn off when it's done talking.
Here is the correct code, I did change the sleep below so it would blink faster, also I am just using D0 so I # D1 out $pwmvalue = 0 $soundright = 0
code:
# Sound servo to PWM range Script # Author: Rich # Version: 1.0.0 # Date: 25th June 2013 # modified by EzAng August 2020
# Variables (do not adjust) # $soundright = auto $pwmvalue = 0 $soundright = 0
# Sound servo to PWM range Script # Author: Rich # Version: 1.0.0 # Date: 25th June 2013
# Variables (do not adjust) # $soundright = auto $pwmvalue = 0
# Sound servo to PWM range Script # Author: Rich # Version: 1.0.0 # Date: 25th June 2013
# Variables (do not adjust) # $soundright = auto $pwmvalue = 0
# Main script # Set the start point for the never ending loop :loop # Check the variable from the Sound servo control against a list of pre-determined levels (you may need to change these) and set the PWM value to suit. IF ($soundright < 10) $pwmvalue = 0 ELSEIF ($soundright < 20) $pwmvalue = 10 ELSEIF ($soundright < 30) $pwmvalue = 20 ELSEIF ($soundright < 40) $pwmvalue = 30 ELSEIF ($soundright < 50) $pwmvalue = 40 ELSEIF ($soundright < 60) $pwmvalue = 50 ELSEIF ($soundright < 70) $pwmvalue = 60 ELSEIF ($soundright < 80) $pwmvalue = 70 ELSEIF ($soundright < 90) $pwmvalue = 80 ELSEIF ($soundright < 100) $pwmvalue = 90 ELSE $pwmvalue = 100 ENDIF
# Set the PWM with the value chosen above (you may need to change the port to suit) # PWM(D1, $pwmvalue) PWM(D0, $pwmvalue) # Add any other PWM ports above this line with PWM(PortNo, $pwmvalue)
# Sleep for 100ms to avoid saturation (you may need to adjust this to increase accuracy or increase stability. Reduce the delay for better accuracy, increase for better stability) Sleep(1000)
You're saying "servo mic". What is "servo mic"? I see Sound servo (EZB), Sound servo (PC), Sound servo (EZB Playback), Sound servo (PC Mic), and Sound servo (PC Speaker), but I'm not seeing any "Servo Mic". I'm trying to get the LED to respond to the speech coming out of the EZB, so which of those do I use for that? You said that for the LED, all that I need is the script and the servo mic control, but then you say that I need to have the Sound PC v4 paused?
And I can't run the script. It's just giving me this:
Code:
Line 1: Unexpected token ILLEGAL
Again, I PROMISE YOU, I'm not TRYING to be confused or argumentative here.
The Talk servo control doesn't do anything. The LED is just stuck at a constant dim glow.
I tried going back to Nomad's original set-up and thought maybe.... MAYBE my issue was that I was putting this code into the JavaScript instead of the EZ-Script section... but now I'm back to the dim, random blinking.
"Whatever my friend"? Look, I'm not blowing off what you're telling me for my own amusement. I have nothing to gain by asking for help, and then ignoring it. I just want to get this thing to work.
And yes, I've lowered it to 1 and raised it to 180. Nothing changed. I've raised the value in the script from 100 to 1000 to see if that might make it the slightest bit brighter. Nothing changed.
EzAng The connection of the LEDs isn't the issue. I figured out the hard way that infrared LEDs aren't what we want for this kind of project, I had them replaced, and I figured out how to get them to flash like I wanted.
Nomad I started a new project, I added a sound servo mic to it, I put the code that you wrote into EZ-script, I made a new script with the suggested text, and I added the PWM (but I don't know what you mean by "in the script for second LED").
It's still flickering as dimly and randomly as it was before.
you need only one script running for the leds. ad the second led in the script. what i mean with second script is what you want to say when the led is flaching.
can you post a pic from your settings sound servo ?
The blocky code to tell the LED what to do.... (Port D14 is where the LED has been successfully connected, so the code is modified to incorporate port D14.)
The script of a bit of test dialogue...
The settings for my PWM control.
I raise the slider on the PWM (which immediately snaps back into the OFF position), I hit the START button on the script controls, and THIS is the result.
It's talking, but we don't SEE it talking. And even if we COULD see it talking, it would look like THIS.
I want the talking LED to be as bright as the eye LEDs, and I want it to flash with each spoken syllable, but neither action is taking place. When it DOES work, it's stuck at a barely visible random flicker, and it continues even after the speech has stopped.
"i see only one pwm in his project." No mention of needing more than one PWM was made before now.
"Or a simple script to turn on and off:" I just tried that new script you provided.
This isn't giving me the effect I want.
"I see you have sound servo mic. you need sound servo (PC)" This is EXACTLY what I've been talking about this entire time; these are the most confusing, unclear instructions I've ever read in my life. Nomad said that I needed "servo mic". I pointed out how there ISN'T any control listed as "servo mic", that there are instead FIVE different sound servo Controls, and even after listing each one by name, all he said was "Sound Servo". I switched over to Sound servo (PC) after you made that suggestion, and THAT didn't work either. (Post #73)
But okay.... Just for the sake of argument.... Just to show you that I'm honest-to-everything-holy TRYING here... I'm going to re-insert the original code combined with the Sound servo (PC) control....
Original LED script, modified with $Soundv4Value and D14...
The final result....
*sigh* No... It's still too dim, it's not blinking in sync with the dialogue, and it prematurely stops blinking before the dialogue is completed. Then again... it actually TURNS OFF when it's done talking.
the sync off the LED wil not work 100% correct.you will need to try diff kinds off LED. you wil need clear LED with higher MCD .some between 500 and 1000 mcd also you can tinker a little with these settings .
there is another way to get beter sync for the LED ,that is solder the wire on the pads from the speaker. any sound that comes out the speaker,the LED will flach same ritme.here a video.
There are a couple methods in hardware that you can do. As Nomad mentioned you could use a Super Bright LED that has a high millicandela (mcd) value.
Another way to make it bright is to use a transistor and adjust the resistor so that more current gets to the LED. An LED hooked up to an EZ-B I/O port is limited to 10mA by the on-board resistor but you can still use an I/O port to control a transistor to get access to more current.
Rich wrote a great tutorial here about using a transistor to control a bulb. A TIP120 is a bit overkill for your application but you can use the same concept with a common 2N3904.
One thing to note is that with PWM you'll always want to stay near the higher percentages for your on time as that will keep the LED bright.
Come to think of it, I like Nomad's idea of using the speaker voltages to activate the LED, it would need to be attached to the amplified side of the amplifier (extra speaker pins), combine that with a transistor circuit and I think that could work well.
Okay, but how did you attach your LED to your speaker? You said you soldered it to the pads of the speaker? The soldering I understand, but what/where are the pads of the speaker? Apparently it doesn't matter in which direction you solder the wires of a speaker to the EZB, but I wouldn't think that's the case with LEDs, right? The proper position of positive vs. that of negative DOES matter, doesn't it?
But where am I connecting the LED? The speaker has positive and negative terminals, you hook those up to the EZB, but where on the pads do you put the LED? I need to reiterate the point that I'm not trying to be confused or argumentative here, but it sounds like you're telling me to just put the LED anywhere and that will work.
https://www.ez-robot.com/Tutorials/UserTutorials/135/1
sorry late respons.
error line 14
thank you for the link, never saw that tutorial until now.
It means you have not added a $SoundValue in the Sound Servo. in rich's example he has soundvaule you should have $SoundValue in the variable name in the Sound servo config.
Change it to $SoundValue
Nether have I until Nomad asked, I never had a need before.
ah so simpel and i did not see it.thank you.
but thats not the effect am looking for.am looking for the led to lid up when jd speaks .
Am guessing you are using the built in speaker on the EZB controoller. Use the servo Servo (EZB Playback) not the Sound Servo.
If so just change the variable name from $soundvalue to $Soundv4Value in your script.
Example...
if ($Soundv4Value < 10)
$pwmvalue = 0
ELSEif ($Soundv4Value < 20)
Change it to ...
if ($EZBPlayingAudio < 10)
$pwmvalue = 0
ELSEif ($EZBPlayingAudio< 20)
in your script.
i have a led on port D22.
chould the led connected to port d12 as in pic d22 flikker on the ritme of speech?
when a audio is payed?
are these pics correct ?
i mean the led must go on when he speaks.
I then used my RGB animiator display in my JD (Spock) and created 3 different static display for a KITT (Knight Rider) type voice display (the 3x3s don't make a good KITT display, but that's not important.
I just wanted to see if I could use the Sound servo PC to make the RGB "dance" to music and I can.
If the value is less than 10, I set the display to blank.
Kitt1, Kitt2 and Kitt2 represent brightness levels for my animation display pattern.
Code:
I have commented out the Print values, those were for testing and debugging and I would recommend anyone use those to test their scripts so they can see what Sound servo controls are responding too.
What I have not adjusted yet are the Update Speed and Scalar under the Sound Settings of the Sound servo control. As anyone played with those setting much? I'd like to improve the rate the my RGB display changes state to the sound level.
i try the above script for the rgb.i dont understand,what chould the script doing?
is it this what the script chould be doing?
that sounds great.i made a project you can adjust the rgb motions if you want.
there are tree rgb and 1 blank.kitt1 kitt2 kitt3.
knight rider
I think what you meant to say is that you posted your project and not that you made a plug in. No worries. Language barriers suck. LOL.
Thanks again!
i was thinking that it was wrong.thanks for the correction.
see post #27 it says knight rider
is there a script for the rgb to go on and out a the ritme off speech or sound/music?
But if you have preset sound files pre-recorded, I think the other way is to add an audio track to an EZBv4 Sound Board (PC sound board does not have the option for edit) and use the Edit function as The Robot Program shows in Episode 034 just like making DJ dance you can alter it to make the RGB animations "dance":
ah thats why it didn work.the robot program is awesome,i chould look into it more.
you gonna love this.the real knight rider .i updated the rgb visions.
they are really cool.kitt 1 is also updated but in the video not to see.
i saw the kit car only one time in belgium hasselt.he is huge car.
when you speed up the sound servo,it just go's slower.is it possible ,
to ad more settings in the sound servo list for speed?
like excample 0.75
0.50
0.25 will that speed up the sound servo?
Is it supposed to be doing this, or is there some variable I'm missing?
Bobsheaux
its best to stay on your topic.dj dont like it when you make multiple topics on same issue.
set the sleep higher .
if you have a new question ,no problem,open a new topic.
original post "talk servo" - I use these settings, I am using D0 - you an use any port number, just connect your LED
make sure you connect you LED:
1) Connect the LED's Anode (+) (long side) wire to the signal (white) pin D0 of the EZ-B.
2) Connect the LED's Cathode (-) (short side) wire to the ground (black) pin D0 of the EZ-B.
Make sure you put the min 1 and the max 180
I made a coffee time script: - you can make any script.
SayWait("Good morning my robot crew.")
sleep(60)
SayWait("Are you just waking up.")
sleep(60)
SayWait("now that you are up.")
sleep(60)
SayWait("time for coffee.")
sleep(60)
SayWait("coffee time.")
sleep(60)
SayWait("come and get your 1st cup of coffee.")
sleep(60)
SayWait("so we can start this day.")
sleep(60)
another way to use the "talk servo" - I used my "talk servo" here"
https://synthiam.com/Community/Robots/My-new-and-improved-Talk-Servo-19144
LED info is on:
https://synthiam.com/Community/Tutorials/Pulse-Flash-LED-with-PWM-16230
EzAng
This isn't working because I can't make it stop cutting off the last few words of my phrase (making the sleep higher did nothing).
The Talk servo isn't working because I can't get it to turn off when the EZB isn't saying anything.
Why does the Sound servo only kinda-sorta work with the Speech Synthesis control, but not at all with the Bing Speech Recognition? (The Talk servo seems to work(ish) with Bing.)
In either case, the LED's too dim to see unless the robot's in total darkness (and yes, I'm using LEDs which emit VISIBLE light, not infrared).
i can see now what you mean .my led flaches very little and dont stop.
got it.i can make a video if you want?
1 mouth moving with speech ?
2 or lid up a led while speeking?
hope this video helps.
(Ignore the flashing eyes, they're actually staying solid, save the "blinking" every 4 seconds.)
does each led has its own port?
Hang on... Sound MIC script? Did you mean to ask where my script for the Sound servo is? Because I do have that in my controls, I just didn't think I needed to include that in the screengrab for the purposes of this video. This original tutorial said to have a script for the Sound Servo, but are you saying I need a script for the Sound Mic too/instead?
And yes, each LED is in its own port.
Nomad and I have showed you many ways to use the LED, just follow instructions please:
Here is DJ's take on LED again:
https://synthiam.com/Community/Tutorials/Pulse-Flash-LED-with-PWM-16230
Here is a script that works like Dave's R2 robot, on and off:
remember, you can say anything
# set the servo speed to 2
ServoSpeed(d0, 2)
pwm(d0, 0)
sayezb("good morning")
sleep(2000)
pwm(d0, 0)
sayezb("how are you")
sleep(2000)
pwm(d0, 0)
sayezb("have a great day")
sleep(2000)
pwm(d0, 0)
my screen:
talk servo
open the PWM control for just on and off - slider
another script for on and off
# set the servo speed to 2
ServoSpeed(d0, 0)
:loop
# Set LED On
pwm(d0, 100)
# wait some time for the pwm to do its ramping thing
sleep(1000)
#set LED Off
pwm(d0, 0)
# wait some time for the pwm to do its ramping thing
sleep(1000)
goto(loop)
Here is a script that syncs with words and shuts off after each sentence.
SayEZBWait("Good evening.")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("Almost time for dinner.")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("Are you hungry?")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("What are we having?.")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("some thing lite I hope.")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("I am still full from lunch.")
pwm(d0, 0)
sleep(1000)
pwm(d0, 0)
SayEZBWait("have a great day.")
pwm(d0, 0)
I do notice I have to disconnect and connect sometimes
EzAng
for led you need only the window servo mic and this script .
# Sound servo to PWM range Script
# Author: Rich
# Version: 1.0.0
# Date: 25th June 2013
# Variables (do not adjust)
# $soundright = auto
$pwmvalue = 0
# Main script
# Set the start point for the never ending loop
:loop
# Check the variable from the Sound servo control against a list of pre-determined levels (you may need to change these) and set the PWM value to suit.
if ($soundright < 10)
$pwmvalue = 0
ELSEif ($soundright < 20)
$pwmvalue = 10
ELSEif ($soundright < 30)
$pwmvalue = 20
ELSEif ($soundright < 40)
$pwmvalue = 30
ELSEif ($soundright < 50)
$pwmvalue = 40
ELSEif ($soundright < 60)
$pwmvalue = 50
ELSEif ($soundright < 70)
$pwmvalue = 60
ELSEif ($soundright < 80)
$pwmvalue = 70
ELSEif ($soundright < 90)
$pwmvalue = 80
ELSEif ($soundright < 100)
$pwmvalue = 90
ELSE
$pwmvalue = 100
endif
# Set the PWM with the value chosen above (you may need to change the port to suit)
PWM(D1, $pwmvalue)
PWM(D0, $pwmvalue)
# Add any other PWM ports above this line with PWM(PortNo, $pwmvalue)
# Sleep for 100ms to avoid saturation (you may need to adjust this to increase accuracy or increase stability. Reduce the delay for better accuracy, increase for better stability)
Sleep(100)
# Jump back to the start
Goto(loop)
CHECK THIS BOX
EzAng
I followed these new instructions you gave me, and I'm still running into the same problems as before; the LED's just barely flickering at random, and it doesn't turn off when it's done talking.
one step at the time i gess.
do you have two pwm's in your project?
on the top
$soundright = 0
or code will not work
EzAng
i only changed the ports below.what means initialize ?
$pwmvalue = 0
$soundright = 0
code:
# Sound servo to PWM range Script
# Author: Rich
# Version: 1.0.0
# Date: 25th June 2013
# modified by EzAng August 2020
# Variables (do not adjust)
# $soundright = auto
$pwmvalue = 0
$soundright = 0
# Sound servo to PWM range Script
# Author: Rich
# Version: 1.0.0
# Date: 25th June 2013
# Variables (do not adjust)
# $soundright = auto
$pwmvalue = 0
# Sound servo to PWM range Script
# Author: Rich
# Version: 1.0.0
# Date: 25th June 2013
# Variables (do not adjust)
# $soundright = auto
$pwmvalue = 0
# Main script
# Set the start point for the never ending loop
:loop
# Check the variable from the Sound servo control against a list of pre-determined levels (you may need to change these) and set the PWM value to suit.
IF ($soundright < 10)
$pwmvalue = 0
ELSEIF ($soundright < 20)
$pwmvalue = 10
ELSEIF ($soundright < 30)
$pwmvalue = 20
ELSEIF ($soundright < 40)
$pwmvalue = 30
ELSEIF ($soundright < 50)
$pwmvalue = 40
ELSEIF ($soundright < 60)
$pwmvalue = 50
ELSEIF ($soundright < 70)
$pwmvalue = 60
ELSEIF ($soundright < 80)
$pwmvalue = 70
ELSEIF ($soundright < 90)
$pwmvalue = 80
ELSEIF ($soundright < 100)
$pwmvalue = 90
ELSE
$pwmvalue = 100
ENDIF
# Set the PWM with the value chosen above (you may need to change the port to suit)
# PWM(D1, $pwmvalue)
PWM(D0, $pwmvalue)
# Add any other PWM ports above this line with PWM(PortNo, $pwmvalue)
# Sleep for 100ms to avoid saturation (you may need to adjust this to increase accuracy or increase stability. Reduce the delay for better accuracy, increase for better stability)
Sleep(1000)
And I can't run the script. It's just giving me this:
Code:
Again, I PROMISE YOU, I'm not TRYING to be confused or argumentative here.
my script for blink is this.
pwm(d0,100)
pwm(d1,100)
sleep(500)
pwm(d1,0)
sleep(500)
pwm(d1,100)
its the window sound servo .
EzAng
EzAng
do you mean this?
# $soundright = auto needs to be # $soundright = 0
in code we initialize it with 0 - zero
$soundright = 0
Just like $pwmvalue = 0
was initialize with 0 - zero
or $soundright = auto
will work
EzAng
thats good info thanks.
$pwmvalue = auto
lol
All works
I guess the real question is did Bobsheaux get it?
EzAng
no i didn know that.
$soundvalue = auto
$pwmvalue = 0
works the best
EzAng
# set the servo speed to 2 or whatever, I use 0
ServoSpeed(d0, 0)
:loop
# Set LED On
pwm(d0, 0)
# wait some time for the pwm to do its ramping thing
sleep(1000)
#set LED Off
pwm(d0, 100)
# wait some time for the pwm to do its ramping thing
sleep(1000)
goto(loop)
I'm using the Sound servo (PC) controller, I used the new script that you wrote, I've got one PWM window running... and it's STILL not working.
Code:
line 1 is nothing.
are you using ez script or somthin els ?
try the talk servo
use the controls I have
make the min 1 and the max 180
EzAng
I tried going back to Nomad's original set-up and thought maybe.... MAYBE my issue was that I was putting this code into the JavaScript instead of the EZ-Script section... but now I'm back to the dim, random blinking.
you did change the min to 1 and the max to 180?
try everything :-)
EzAng
for LED its min 1 to 100 max
And yes, I've lowered it to 1 and raised it to 180. Nothing changed. I've raised the value in the script from 100 to 1000 to see if that might make it the slightest bit brighter. Nothing changed.
can you send me a picture or video of what you are doing?
On the LED make sure:
1) Connect the LED's Anode (+) (long wire) wire to the signal (white) pin D0 of the EZ-B.
2) Connect the LED's Cathode (-) (short wire) wire to the ground (black) pin D0 of the EZ-B.
EzAng
can you take a new ARC project and put in 3 things.
1 sound servo
2 ez script from post # 74
3 ez script whit some text .excample sayezb(" hello my friend , nice to see you " )
4 ad the second pwm below in the script for second LED
thats all you need
The connection of the LEDs isn't the issue. I figured out the hard way that infrared LEDs aren't what we want for this kind of project, I had them replaced, and I figured out how to get them to flash like I wanted.
Nomad
I started a new project, I added a sound servo mic to it, I put the code that you wrote into EZ-script, I made a new script with the suggested text, and I added the PWM (but I don't know what you mean by "in the script for second LED").
It's still flickering as dimly and randomly as it was before.
you need only one script running for the leds.
ad the second led in the script.
what i mean with second script is what you want to say when the led is flaching.
can you post a pic from your settings sound servo ?
here is the LEDs I used - $8.98 for many types
https://www.amazon.com/Haitronic-assorted-Prototyping-breadboard-circuitry/dp/B01MYWS9IW/ref=sr_1_2?dchild=1&keywords=led+hobby&qid=1598022758&sr=8-2
Take a screen shot (print screen) prt sc on keyboard
copy and paste
EzAng
i see only one pwm in his project.
post #84 see pic.
and add
Or a simple script to turn on and off:
code:
# set the servo speed to 2 or whatever, I use 0
ServoSpeed(d0, 0)
:loop
# Set LED On
pwm(d0, 0)
# wait some time for the pwm to do its ramping thing
sleep(1000)
#set LED Off
pwm(d0, 100)
# wait some time for the pwm to do its ramping thing
sleep(1000)
goto(loop)
Edit Comment
you need sound servo (PC)
EzAng
you got somethin here. bolt saying sound servo pc ,one says sound servo speakers.
under servo not audio
sound servo (PC)
do you have the latest version ARC ?
yours is correct .
bobsheaux
ezang is correct. see sound servo pc in his pic ,post 94 .
it chould work now .me bad sorry about that.
EzAng
am still here.;)
do you use desame sound servo pc for moving the mouth?
EzAng
Here's my project.
Sound servo Mic...
The blocky code to tell the LED what to do.... (Port D14 is where the LED has been successfully connected, so the code is modified to incorporate port D14.)
The script of a bit of test dialogue...
The settings for my PWM control.
I raise the slider on the PWM (which immediately snaps back into the OFF position), I hit the START button on the script controls, and THIS is the result.
It's talking, but we don't SEE it talking. And even if we COULD see it talking, it would look like THIS.
I want the talking LED to be as bright as the eye LEDs, and I want it to flash with each spoken syllable, but neither action is taking place. When it DOES work, it's stuck at a barely visible random flicker, and it continues even after the speech has stopped.
"i see only one pwm in his project."
No mention of needing more than one PWM was made before now.
"Or a simple script to turn on and off:"
I just tried that new script you provided.
This isn't giving me the effect I want.
"I see you have sound servo mic. you need sound servo (PC)"
This is EXACTLY what I've been talking about this entire time; these are the most confusing, unclear instructions I've ever read in my life. Nomad said that I needed "servo mic". I pointed out how there ISN'T any control listed as "servo mic", that there are instead FIVE different sound servo Controls, and even after listing each one by name, all he said was "Sound Servo". I switched over to Sound servo (PC) after you made that suggestion, and THAT didn't work either. (Post #73)
But okay.... Just for the sake of argument.... Just to show you that I'm honest-to-everything-holy TRYING here... I'm going to re-insert the original code combined with the Sound servo (PC) control....
New set-up....
Sound servo (PC)...
Original LED script, modified with $Soundv4Value and D14...
The final result....
*sigh* No... It's still too dim, it's not blinking in sync with the dialogue, and it prematurely stops blinking before the dialogue is completed. Then again... it actually TURNS OFF when it's done talking.
I'm exhausted....
the sync off the LED wil not work 100% correct.you will need to try diff kinds off LED.
you wil need clear LED with higher MCD .some between 500 and 1000 mcd
also you can tinker a little with these settings .
there is another way to get beter sync for the LED ,that is solder the wire on the pads from the speaker.
any sound that comes out the speaker,the LED will flach same ritme.here a video.
this way you cant cotrole the LED itself.
There are a couple methods in hardware that you can do. As Nomad mentioned you could use a Super Bright LED that has a high millicandela (mcd) value.
Another way to make it bright is to use a transistor and adjust the resistor so that more current gets to the LED. An LED hooked up to an EZ-B I/O port is limited to 10mA by the on-board resistor but you can still use an I/O port to control a transistor to get access to more current.
Rich wrote a great tutorial here about using a transistor to control a bulb. A TIP120 is a bit overkill for your application but you can use the same concept with a common 2N3904.
One thing to note is that with PWM you'll always want to stay near the higher percentages for your on time as that will keep the LED bright.
Come to think of it, I like Nomad's idea of using the speaker voltages to activate the LED, it would need to be attached to the amplified side of the amplifier (extra speaker pins), combine that with a transistor circuit and I think that could work well.
I see you have sound servo mic - wrong
under servo
you need sound servo (PC)
EzAng
So in THIS tutorial...
https://synthiam.com/Community/Questions/Breaking-Out-The-Sound-From-The-V4-Ezb-8463
...Jeremie says that positive or negative doesn't matter when hooking up an external speaker to the EZB (post #32). How exactly is the LED in your last video hooked up to your speaker?
iff you take for excample a white wire and solder on the SPKR .
then connect the ezbv4 to your arc.
then touch with the wire the pins off the speaker.only one way will work.
as jeremie stated color positif or min does matter.
here you see color red on the left side.but it works also with the red on the left.
its the other side of the wire thats going on the speaker that you need to test,
it doesn matter on the ezbv4 what + or - is.
but on the speaker or LED you have to test wish wire goes where.
you can use colored wire if that easier to remember witsh color goes where.
1 solder a wire on the ezbv4 ( long enough ) see pic ptp
2 strip the wire on the other side .
3 connect your ezbv to arc
4 play sound file or sayezb
:loop
sleep(2000)
sayezb(" testing my speaker ")
sleep(2000)
goto(loop)
5 tough with the wire the pads from the speaker ,if you dont hear sound switsh sides .mark one wire so you know wish pad it goes.
6 sound file is still playing ,now connect the LED and see if it lids up ,if not swish sides and mark one off the wire.
7 connect the wires that youve marked together ,and connect the two together that doesn is marked.
8 solder the wires on the pads or you can use one off these see pic.
after you tested witsh wire goes where.
I always finish and understand a project before I go on to something else.
EzAng
Man, all of this was a chore... But it's WORKING. Whew!...
that looks fantastic.and sounds great.
Hi Nomad, how are you?
EzAng
Up to the past again - I just created again LEDs being activated by a script for sound
Used Rich's script also from the past.
wow, everything is from the past, lol
Hey Nomad, I this is old news, but it does work