how to transfer two value which inputed through a keyboard to another object?
daniel ding
Posts: 52
hi everyone
I use a keyboard to input two value and put the value I input transfer to another object. what should I do?
thanks
I use a keyboard to input two value and put the value I input transfer to another object. what should I do?
thanks
Comments
Be patient with me as I am still learning to be patient with those still learning.
One of the objectives of this forum is to HELP, however that does not mean for every single microstep of the way. Surely you know how to pass values as there are numerous examples in the forum and obex. Have you practiced the examples that are in the Propeller manual? Do this first and make sure you understand it rather than simply by "copy and paste" or whatever anybody else shows you.
Anyway, the answer to your question is very simple yet you have provided no details whatsoever of the code or the object. Learn to provide details which requires thinking about it which in turn may produce the solution for you,
There are several ways of doing this.
You can have a parameter in your start method with the address of the variables.
Your top object would use code like this.
The child object would use:
Here's another way.
The child object would use:
Those are a couple of ways.
Both of these examples assume you want the child object to do something when x or y change. If you don't need to monitor for changes, you don't need the variables "oldX" and "oldY".
Both examples also assume you want a loop in the child object to run in it's own cog. You could have the child object use the same cog as the parent object if it's okay for the parent object to wait for the child object to complete its tasks.
Edit: Yes to what Peter said, or you might find that someone is it in the mood to type (because it's easier than working on their own project).
Thanks your advises, u are wright.
I will be patient enough to learn more from the propeller manual.
As you know as a beginner it is really a hard work for a man who is English as a second language.
Whatever I will work harder and harder to learn it.
thanks again
Daniel
My wife teaches senior science in a high school where English is predominantly the second language and for sure there are difficulties with understanding English let alone the subject. However programming and maths are fairly universal and the concepts are clearly there in the examples such as passing parameters to another function whether it be local or in an "object".
Thanks for your help several days before.
In my program I want to make a out-time of operation.
For one if I press the TAB key, the operation will get a out_time and when I press it again it continues.
I tried (repeat wiatcnt(), pub abort and quit commands but useless)
can u give me some advises.
thanks
Daniel
For this question you started a new thread.
Why is it against forum rules?
Because someone might not know both places when reading it first. Then he answers it, which can take some time and then he figures out that there is already an answer in another thread.
Please respect the forum rules!
I am so sorry.
I will respect the rules, I post a question to Duane first.
Then I thought may be I should post a new thread and get more help from the forum.
I am sorry.
Daniel