jzhao
USA
Asked
— Edited
Hi , I am programming roli in c#. I want roli speak specified words through the EZB4 soundboard. How can I do that? I used EZ_B.Speakjet.SpeakString(EZ_B.Digital.DigitalPortEnum, System.String), but no sound.
Speakjet is a third party microchip that can connect to an ez-b for synthesized sound. What you want is to do one of these two things...
@DJ Sures
Hello dear eng , I use this part of code to make my jd robot speak but it gave me that exception
would you help me plz?
all i need is to make my jd speak a string I gave to it in vs
you would have to provide your code to see where the null reference exception is happening. Can you run in debug mode to see where the break happens?
@CochranRobotics
thanks for the fast replaying here is the complete snapshot of my error
I've made a plugin with one button say , when I click on that button , the jd robot will say what i right in the string but it gave me that exception
Can you show your references? The message would appear to indicate that the ezb or one of its classes isn't present. You might want to download the latest version of ARC if you haven't to make sure that the classes are present. I am in meetings pretty much all day but will try to duplicate the error when I have time.
Make sure that ARC and EZ_B are both referenced. It looks like you are trying to build a plugin using the SDK but I might be wrong. I promise that I will try this out and let you know the results if nobody else gets back to you.
@CochranRobotics
my references was given below & I'm sure they are right
also my ARC version is 30.5 which is the latest version & to check that I'm right if u have the sdk tutorial open c# then choose tutorial 61 & run it it will run but if u put this line of code the program will not work .
Sounds good. I will look at it and see if I can offer any help. Thanks for the info. I will get back to you.
I think that you have to have a connection to the EZ-B V4 before this will work. Does your other code establish a connection to an EZ-B first?
@shaimaabes,
NullReference Exception is very clear, basically you have a NULL object e.g. instance and you try to call or reference a method on it.
looking to the picture:
the class field ezb is not created neither is pointing to a valid reference.
you have two options:
Do it like David mention in the above post, basically you create an EZB instance, connect and you hold it like in a standalone application (remember the other example)
You are building an ARC.plugin, you have access to the ARC.singleton class EZBManager inside this class you have an array of 5 EZBs representing the same 5 EZBs available in the ARC.Connection Control.
the 5 ezbs exists even if they are not connected.
if you prefer you can keep a reference and use the reference:
you can also connect the ezb instance, although i think is not possible to obtain the IP/Address specified in the Connection Box's TextBox
but if you are successful the ARC.Connection Box's Button will turn blue.
if you are building a ARC.plugin you should use the ARC.EZManager to keep the actions in sync with ARC.
Otherwise you will have 2 or more TCP connections to the EZB Controller.
I wouldn't do it like I mentioned, just providing an example showing that the connection has to be established and that the instance of the object has to be established before it's used. More than anything, just showing real quickly that it needs to be setup before it can be used.
@David,
"There's more than one way to skin a cat.", your code works plugin or not.
To be honest i had the idea that only one EZB could be connected (TCP) to the controller, but, it's possible to have 2 or more TCP connections and sending commands.
Although is not possible the EZB use the same TCP channel to initiate a communication and send data (async results), i'm making this deduction based in the WIFI firmare code.
ASFAIK all the EZB controller commands are (sync) initiated from the Host to the controller.
Yeah I'll confirm that this approach contradicts the fantastic and in depth plugin tutorial. Never connect to the ezb in a plugin - there's no reason. Also, you can only have one connection to the ezb at a time.
Original poster, please follow the tutorial that was created to avoid these circumstances.
If you want access to speaker, use the EZBManager.EZBs[0].....
I agree totally. The example was to show why the null reference exception was happening. He was trying to use the object before it was created as it was never created. Also there was some confusion as to if they were making a plugin or if they were making something with the C# SDK. I am of the opinion that they were making something from the C# SDK due to the category and reference to tutorial 61. The confusing thing comes in with the way that the form is inheriting from UCForms.PluginMaster. Not sure still which they are trying to do, but maybe they will come back on and clarify.
Oh, I see now... The original poster wasn't the same person who asked the question today.
It would probably be best to start a new thread with the correct category so that it doesn't confuse those who are trying to help.
All good...
@CochranRobotics
thanks for ur help it's working nw I could here my jd <3 thanks alot
@ptp thanks for being always here , replying on my questions