Blockly - EMIC 2 Text_to_Speech_demo
twm47099
Posts: 867
I rewrote my C program demo of the Parallax EMIC2 text to speech board using Blockly. The C program is here:
forums.parallax.com/discussion/163425/emic2-text-to-speech-demo-in-c-for-the-propeller
The Blockly page is here: blockly.parallax.com/blockly/projects.jsp#3982
The attachments show the blocks.
This was a confusing program to write using Blockly, specifically when getting numerical values from the terminal and then sending them to the EMIC2. I had a difficult time using the integer-to-string blocks. If I input int x from the terminal (it was an integer), and then used the integer to string block, the variable x was turned into a char (in the c code where variables are declared.) That resulted in errors. It is necessary to send numbers as strings to the EMIC2.
I had to make variable assignments of x =0, xstring = abcdefghijklmnop (repeated for y and answer) to make sure the variables started out as the correct type. But even then when I used the integer to string block, x (etc.) became a char and I got errors.
I also had to make dummy variables (xvalue = x) and then use xvalue in the integer slot and store the string of xvalue in xstring. Again looking at the C code, x remained an int, xvalue and xstring are both chars.
Another issue was when I wanted to send "x + y = answer" to the emic, I was not able to convert xvalue, yvalue, and avalue to xstring, ystring, and astring, and then send them to the emic2. The last value converted appears to have overridden the first two. In other words if xvalue =45, yvalue =15, and avalue = 60, if I converted all three of them to xstring, ystring, and astring and the sent them to emic, they were spoken as "60 plus 60 equals 60". They also printed to the terminal as 60 + 60 = 60. I resolved that by converting each variable and sending it before converting the next.
However, issues aside, Blockly is fun to use.
Tom
forums.parallax.com/discussion/163425/emic2-text-to-speech-demo-in-c-for-the-propeller
The Blockly page is here: blockly.parallax.com/blockly/projects.jsp#3982
The attachments show the blocks.
This was a confusing program to write using Blockly, specifically when getting numerical values from the terminal and then sending them to the EMIC2. I had a difficult time using the integer-to-string blocks. If I input int x from the terminal (it was an integer), and then used the integer to string block, the variable x was turned into a char (in the c code where variables are declared.) That resulted in errors. It is necessary to send numbers as strings to the EMIC2.
I had to make variable assignments of x =0, xstring = abcdefghijklmnop (repeated for y and answer) to make sure the variables started out as the correct type. But even then when I used the integer to string block, x (etc.) became a char and I got errors.
I also had to make dummy variables (xvalue = x) and then use xvalue in the integer slot and store the string of xvalue in xstring. Again looking at the C code, x remained an int, xvalue and xstring are both chars.
Another issue was when I wanted to send "x + y = answer" to the emic, I was not able to convert xvalue, yvalue, and avalue to xstring, ystring, and astring, and then send them to the emic2. The last value converted appears to have overridden the first two. In other words if xvalue =45, yvalue =15, and avalue = 60, if I converted all three of them to xstring, ystring, and astring and the sent them to emic, they were spoken as "60 plus 60 equals 60". They also printed to the terminal as 60 + 60 = 60. I resolved that by converting each variable and sending it before converting the next.
However, issues aside, Blockly is fun to use.
Tom