Another emic2 question (speaking variables)
Jim the Hermit
Posts: 79
I was wondering how do I make it say
Serial.Str(String("The temperature is, ")) X
Serial.Str(String("degrees."))
serial.TX(pst#NL)
Serial.Str(String("The temperature is, ")) X
Serial.Str(String("degrees."))
serial.TX(pst#NL)
Comments
Each line sent to the Emic2 needs to start with a "S" in order for it to be said.
I think this would work.
So..... how do I do names?
"Hello, "; name(1); "I have a message for you."
This kind of depends on how names are stored.
Here's one example.
I haven't tested the above, but I'd be surprised if it didn't work.
If you want to access a name based on an index number things get a bit trickier. On way to find a string based on an index number is make each string the same length so you know where the string you want starts.
With this technique you need to make sure you leave the correct number of zeros to keep the name aligned.
If you don't want to keep track of the size of names, you can have the Propeller count through the names for you.
In this last example the names can be any size but need to have a terminating zero.
Sadly, I will probably need the second or third method. Gotta learn more spin first.
I sure miss commodore basic;
x=3: dim a$(x)
a$(0) = "Jim": a$(1) = "Duane": a$(2) = "Joe"
Again, I haven't tested this code but I'm pretty sure it would cause the Emic2 to cycle through the names in the list.
Assigning an element in the array "namePtr" with the address of each of the names allows the names to be easily accessed. I think it requires a bit more setup work than your Commodore Basic example but once the array is setup, it's pretty easy to use.
There are of course many ways to accomplish the same thing in Spin. This is just one of many ways to access text strings with an index number.
Edit: I just realized I kept using the word "display" when I should have been using "speak" or "say".
I was wondering how you did it, Duane. Thanks again.
Here's a link to a tutorial Phil wrote on using code tags.
I take it the code is working as expected?