2017-06-29 06:50 AM
Section 5.2 of the AN4964 gives an example of using micropython to handle the +WIND messages.
Please could you provide a link to the source code for the WIND module - as I am need to access more than just the +WIND code ( i.e. w.code() ). What other attributes are available on the 'w' object as I need to access the data that is sent within the
+56 'Input to remote' %s Input ID
+57 'Output from remote' %u:%s Received message
Note: micropython does not support 'vars' command so i cannot lookup the object attributes in the code, so need assistance on how to get the data from within the micropython script
2017-06-29 11:46 PM
Hi,
in order to get the WIND's full list of parameters you should use the params() method, that was not fully functional. We fixed it in the next release. Please note that the print of WIND messages is disabled when REPL is waiting for user commands.
Following an example of usage.
from utime import sleep
from network import ssifrom pyb import WINDa=WIND()def cb(): print(a.code()) p=a.params() print(p) if p[0] == 56: ssi(':This is a message for YOU!:')a.callback(cb)while True: sleep(0.1)Expected behavior:
<---- go to input demo page
56
[56]
<---- go to output demo page and type'This is my answer!'
57[57, '18', 'This is my answer!']Answer to Note: maybe you can use 'help' command to get what you need
2017-06-30 02:50 AM
Hi Elio
I have a couple of questions:
1) When i try your code above, I get an error: 'ImportError: cannot import name ssi' - how do i get the ssi module?
2) When I try you code above (with the SSI bit removed),
p
rint(a.code())
p=a.params() print(p)Always results in
56
[ ]
ie, I do not get anything in my params listYou mentioned that this is fixed in the 'next release'. When is that scheduled to be released? and how do i get it?
Also, even if i got [56] like you have mentioned, I dont think this gives me the information that I want as this is just giving me the a.code() again. How do I know which of the SSI's from my webpage I am responding to?
i.e. Section 3 of the A
N4965 - WebServer on SPWF04S module shows that my HTML can contain different SSIs.<!--|00|SelStart|0|--> <select name=�aName� MULTIPLE>
<!--|01|Select|3|--> <option SELECTED value=�aValue�>someText
The micropython will get notified of a '56' callback for each one - so how do i know which SSI to respond too.. I would expect to receive the parameters of the SSI e.g
|00|SelStart|0 into the micropython callback
3)
For theoutput demo page, what is the '18' is this just the length of the data being received, i.e. the length of
'This is my answer!'
2017-07-03 02:44 AM
In addition to my questions above, do you know if the micropython is able to access the filesystem directly to write to files? I have tried a simple open file, write, close file - but seem to get an OSError:245
2017-07-06 04:53 PM
Hi Marc,
1) ssi module was unreachable because of a typo in the source code. It has been fixed in 1.1.0
2) WIND module has some limitations in fw 1.0.0, it is fully functional in fw 1.1.0. code() will only return the indication number, while params() will remove the indication from the queue and return a list containing the indication code as first parameter, followed by others parameters (like in the example above).
I have forwarded a request about the misalignment between the documentation and actual behavior of WIND 56, but still I cannot say if it will be fixed in 1.1.0.
3) the '18' is the length of the data being received
4) micropython is actually able to access the filesystem directly. Please be sure to prepend the volume number to the file name. Ex. to open 'msg.txt' on Ram Disk in read mode:
f = open('2:msg.txt','r')
2017-08-17 05:01 AM
Hi Elio
Can you please provide details on when the v
1.1.0 will be available and where I can get it from?