Hello Lucas -
I'm sending this directly to you since I'm not sure everyone on the Blocos Forum will want to see all the details and I'm not sure an attachment will go through properly. Please feel free to post this to the forum if you wish.
Following are the answers to your request for more information. I am using an Arduino with Babuino code.
Let me know if you need more information or details.
Thank you for your time and thanks for creating Blocos. It's a great environment!
-jim
Please see Reset_Pgm.png to see the program blocks.
This is the output from Blocos. I've deleted some of the Serial Port stuff at the beginning.
Testando porta 0
porta aberta
checando conexão na porta 0
checkConnection
()
>> testando conexao
....
....
135 0 55
()
Conectado na porta 0
compileAndSend
# pyCricketYacc -> analisarCodigo
pyCricketLex.build() terminou
yacc.yacc() terminou
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'to',1,0)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'start',1,3)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'loop',1,9)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'resett',1,17)'
# pyCricketLex -> t_MOTORATTENTION 'LexToken(MOTORATTENTION,'a,',1,25)'
# pyCricketYacc -> p_procedurecall ('resett')
jump pos: ( None )
**********NEED TO RECOMPILE************
# pyCricketYacc -> p_statement_value
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'on',1,28)'
# pyCricketYacc -> p_statement_motorAttention
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'waituntil',1,32)'
# pyCricketYacc -> p_statement_value
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'timer',1,44)'
# pyCricketYacc -> p_expression_value
# pyCricketLex -> t_NUMBERLITERAL 'LexToken(NUMBERLITERAL,'255',1,52)'
# pyCricketYacc -> p_expression_value
numero literal
# pyCricketYacc -> p_expression
# pyCricketLex -> t_MOTORATTENTION 'LexToken(MOTORATTENTION,'a,',1,58)'
# pyCricketYacc -> p_statement_waituntil
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'rd',1,61)'
# pyCricketYacc -> p_statement_motorAttention
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'stop',1,65)'
# pyCricketYacc -> p_statement_value
# pyCricketYacc -> p_statement_value
# pyCricketYacc -> p_statements_statement
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'end',1,72)'
# pyCricketYacc -> p_statement_loop
# pyCricketYacc -> p_statements_statement
# pyCricketYacc -> p_procedure
p[ 1 ] to
p[ 2 ] start
p[ 3 ] [3, 16, 128, None, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15]
p[ 4 ] end
# pyCricketYacc -> p_procedures_procedure p[0]=p[1]='[0, 3, 16, 128, None, 46,
49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]'
RECOMPILE
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'to',1,0)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'start',1,3)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'loop',1,9)'
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'resett',1,17)'
# pyCricketLex -> t_MOTORATTENTION 'LexToken(MOTORATTENTION,'a,',1,25)'
# pyCricketYacc -> p_procedurecall ('resett')
jump pos: ( None )
**********NEED TO RECOMPILE************
# pyCricketYacc -> p_statement_value
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'on',1,28)'
# pyCricketYacc -> p_statement_motorAttention
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'waituntil',1,32)'
# pyCricketYacc -> p_statement_value
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'timer',1,44)'
# pyCricketYacc -> p_expression_value
# pyCricketLex -> t_NUMBERLITERAL 'LexToken(NUMBERLITERAL,'255',1,52)'
# pyCricketYacc -> p_expression_value
numero literal
# pyCricketYacc -> p_expression
# pyCricketLex -> t_MOTORATTENTION 'LexToken(MOTORATTENTION,'a,',1,58)'
# pyCricketYacc -> p_statement_waituntil
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'rd',1,61)'
# pyCricketYacc -> p_statement_motorAttention
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'stop',1,65)'
# pyCricketYacc -> p_statement_value
# pyCricketYacc -> p_statement_value
# pyCricketYacc -> p_statements_statement
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketYacc -> p_statements
# pyCricketLex -> t_PROCEDURENAME 'LexToken(PROCEDURENAME,'end',1,72)'
# pyCricketYacc -> p_statement_loop
# pyCricketYacc -> p_statements_statement
# pyCricketYacc -> p_procedure
p[ 1 ] to
p[ 2 ] start
p[ 3 ] [3, 16, 128, None, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15]
p[ 4 ] end
# pyCricketYacc -> p_procedures_procedure p[0]=p[1]='[0, 3, 16, 128, None, 46,
49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]'
parse.parse() gerou resultado '[0, 3, 16, 128, None, 46, 49, 3, 5, 17, 1, 25
5, 29, 5, 14, 46, 54, 7, 4, 15, 7]'
code
[0, 3, 16, 128, None, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]
enviar
enviarDados:
[0, 3, 16, 128, None, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]
readByte
writeByte
codigoFinal
problema ao enviar os dados
enviarDados:
[128, 0, 0]
readByte
writeByte
codigoFinal
enviarDados:
[0, 21]
readByte
writeByte
codigoFinal
Code successfully sent!
fechando conexão existente
Look at the code generated (copied from above):
[0, 3, 16, 128, None, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]
^^^^^^^^^^^^
I don't expect the code indicated for the Reset timer block. The rest is OK. When I dump the code written to my Babuino, here is what I get This code is read back in HEX using a Processing sketch.
00 03 10 80 83 00 15 85 00 03 80 00 00 83 0F F0 85 00 02 00 15 00 00
Here is the code that I would expect Blocos to generate for the Reset timer command (in HEX):
00 03 0F 12 2E 31 03 06 11 02 0F A0 1D 05 0E 2E 36 04 0F 07 80 00 00
When I load exactly this gode inot Babuino, it works as expected. This code is loaded and read back using a Processing sketch.
For comparison, if I take out the Reset timer block, this is the code Blocos generates. It loads and runs on Babuino just fine. When I read it back with the Processing sketch, it looks exactly like the Blocos code.
p[ 1 ] to
p[ 2 ] start
p[ 3 ] [3, 14, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15]
p[ 4 ] end
# pyCricketYacc -> p_procedures_procedure p[0]=p[1]='[0, 3, 14, 46, 49, 3, 5, 1
7, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]'
parse.parse() gerou resultado '[0, 3, 14, 46, 49, 3, 5, 17, 1, 255, 29, 5, 1
4, 46, 54, 7, 4, 15, 7]'
code
[0, 3, 14, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]
enviar
enviarDados:
[0, 3, 14, 46, 49, 3, 5, 17, 1, 255, 29, 5, 14, 46, 54, 7, 4, 15, 7]
readByte
writeByte
codigoFinal
enviarDados:
[128, 0, 0]
readByte
writeByte
codigoFinal
enviarDados:
[0, 19]
readByte
writeByte
codigoFinal
Code successfully sent!
fechando conexão existente