-
• #2
The issue is just that your code is taking longer to execute than expected.
Usually, the code you upload should execute as fast as possible, and then you should do any calculations in callback functions - ideally making them execute quickly.
So if you do:
function go() { var plain=new Int8Array(16); var key=new Int8Array(16); var crypt=new Int8Array(16); var dcrypt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; var i; var j; var k; for(i=0;i<16;i++){ plain[i]=0; key[i]=1; dcrypt[i]=0; }//nexti for(k=0;k<256;k++){ plain[1]=k; for(i=0;i<256;i++){ plain[0]=i; crypt=AES.encrypt(plain,key,{mode:'ECB'}); for(j=0;j<16;j++)dcrypt[j]+=(crypt[j]/256); }//nexti }//nextk for(j=0;j<16;j++)console.log(dcrypt[j]/256); } setTimeout(go, 500);
It'll work fine. Or you could just call
go()
from the left-hand side after upload -
• #3
Thanks.
-
• #4
To peek into what's going on on upload, take a look at this conversation about simple explanation how to (upload and) save code that espruino runs on start?.
-
• #5
My esp32 seems to be bricked. Each time I boot, it spits out the text from the attached file and finishes with HALTING. I have tried re-flashing the chip, but the code causing the issue is still on there. Is there a way to clear out the code section of the chip?
1 Attachment
-
• #6
Erase_flash got me back on track! But my real issue remains, why does adding setWatch cause my chip to go into an unusable state?
Sorry for the double post from the Gitter board.
-
• #7
...did you have a setWatch in root level?... 'never' put 'active/sensitive' things into the root level, 'always' put it into a startup function that is called in onInit() or with setTimeout() as last line in upload. With that you prevent getting your Espruino active before it has finished uploading.
-
• #8
Good advise, thank you!
Any thoughts on getting a setWatch to work? Since posting I have been querying the pins on an interval of 10ms.
**ERROR: Prompt not detected - upload failed. Trying to recover...
**
Pico v1.85
Trying out AES in ECB mode as a random number generator and got an error.
Did I do something dumb?
The Output