Any SPIN programs interfacing to wi-fi modules WX ESP8266 or ESP32?

Hi,
Is anyone aware of any sample SPIN programs for the above wi-fi modules?
I have done a search of obex and the web I cannot find any.
Many thanks . .

Comments

  • 10 Comments sorted by Date Added Votes
  • There was some work done with the ESP8266 a few years ago. It was in a thread with ESP8266 in the title.
    Was it Rayman?
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • some old discussion
    https://forums.parallax.com/discussion/160533/serial-communication-with-the-esp8266-using-the-nodemcu-firmware-script-languagelua

    of course it depends what you want to do

    I used ESP8266 loaded with NodeMCU running the Lua interpreter interactively.
    So you just send Lua commands via serial.

    You don't need any special object for this except SERIAL
  • Clock LoopClock Loop Posts: 1,443
    edited April 6 Vote Up0Vote Down
    I think the op wants examples of spin that shows using the CMD structure provided by the firmware included with it.

    wxcommands.jpg



    I use the wx device's serial port with fullduplexserialplus on the prop to send ANSI ESCAPE control codes using the telnet port 23 with putty.
    Its a nice way to format the debug output.




    telnet%20port%2023%20with%20putty%20and%20ansi%20control%20codes.jpg



    Example code is just dumping ansi codes to the serial input on the wx device.. Its pretty simple.
    Connect to port 23 of the ip for your wx device using putty.
    ''*******************************************
    ''*  Telnet Wireless WX Ansi Command  Demo  *
    ''*  Author: Clock Loop @ parallax forums   *           
    ''*******************************************
    
    CON  
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      
              
    CON
    
      Tx             = 30   'serial out to wx device
      Rx             = 31   'serial in from wx device
    
    OBJ
    
      Term          : "FullDuplexSerialPlus" 
    
    Pub Port23Display | Years, Dayz, Hour, Mnit
    
        Years := 13
        Dayz  := 6
        Hour  := 3
        Mnit  := 45
    
    
      
        term.start(Rx, Tx, %0000, 115_200)                                    '1cog start telnet terminal
    
        waitcnt(80_000_000 + cnt)  
        
        term.str(string(27))    'Set command mode                                                     
        term.str(string("[2J"))                                               'Clear telnet screen
    
    
        term.str(string(27))    'Set command mode 
        term.str(string("[1;1f"))  'Set Position
          
        term.str(string(27))    'Set command mode
        term.str(string("[0m")) 'Turn off character attributes
    
                                 
        '--------------SOME ANSI COMMAND CODE INFO---------
            'term.str(string(27))  'Set command mode          
            'term.str(string("[2J")) 'clear screen
                      
            'term.str(string(27))    'Set command mode
            'term.str(string("[0m")) 'Turn off character attributes
            'term.str(string("[1m")) 'Turn bold mode on
            'term.str(string("[2m")) 'Turn low intensity mode on
            'term.str(string("[4m")) 'Turn underline mode on
            'term.str(string("[5m")) 'Turn blinking mode on
            'term.str(string("[7m")) 'Turn reverse video on    
            'term.str(string("[8m")) 'Turn invisible text mode on
         
            'term.str(string("#3"))  'Double-height letters, top half 
            { 
            Esc#3   Double-height letters, top half         DECDHL
            Esc#4   Double-height letters, bottom half      DECDHL
            Esc#5   Single width, single height letters     DECSWL
            Esc#6   Double width, single height letters     DECDWL
            }
            
                  
      
    Repeat
    
            
            term.str(string(27))    'Set command mode 
            term.str(string("[1;1f"))  'Set Position
    
            waitcnt(80_000_000 + cnt) 
            
            term.str(string(27))    'Set command mode 
            term.str(string("[5;5f"))  'Set Position 
    
            term.str(string(27))  'Set command mode 
            term.str(string("[31m")) 'Red color text  
            
            term.str(string("UpTime   : "))
    
            term.dec(Years)       
            term.str(string(":Years  "))
            term.dec(Dayz)       
            term.str(string(":Days   "))
            term.dec(Hour)       
            term.str(string(":Hours   "))
                    
            term.dec(Mnit)       
            term.str(string(":Min   "))
    
    
    
    
    Dat
    {{
    
      Terms of Use: MIT License
    
      Permission is hereby granted, free of charge, to any person obtaining a copy of this
      software and associated documentation files (the "Software"), to deal in the Software
      without restriction, including without limitation the rights to use, copy, modify,
      merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
      permit persons to whom the Software is furnished to do so, subject to the following
      conditions:
    
      The above copyright notice and this permission notice shall be included in all copies
      or substantial portions of the Software.
    
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
      INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
      PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
      CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
      OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
    
    }}
    
    
    
    
    



    Get one of these:

    32420S.png?itok=VUhYV3G1
    https://www.parallax.com/product/32420s

    The propeller RES pin goes to the WX RES pin. (gpio12, DTR)
    The propeller TX pin goes to the WX DI pin.
    The propeller RX pin goes to the WX DO pin.


    Connect the wx device to your network and open its ip address.
    The propeller wx page should show.
    From there you can upload a new copy of the latest firmware if there are any (https://github.com/parallaxinc/Parallax-ESP/releases)

    If you compile the above prop code i attached, using the PropellerTool software https://www.parallax.com/sites/default/files/downloads/P8X32A-Setup-Propeller-Tool-v1.3.2.zip
    Generate a binary by pressing F8, and save the binary to c:\temp\propcode.binary

    You can download and extract the proploader to c:\temp\proploader.exe https://github.com/parallaxinc/PropLoader/releases/download/v1.0-37/proploader-win.zip

    Then run this by pressing the start button, search for program, type in cmd.exe
    press enter and open the program when it finds it
    that opens a command prompt, then paste this command.
    c:\temp\proploader.exe  -I yourwxnameoripaddresshere -e -r propcode.binary
    

    you WILL need to change yourwxnameoripaddresshere to your actual wx ip address or name.

    It will upload the code to your prop connected to the wx device on wifi.

    Then you need putty https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
    And open a connection in putty, telnet port 23 on address: yourwxnameoripaddresshere




    So now you can wirelessly program, and view the debug output of any propeller based project with the parallax wx device, and these instructions.






    "I'll buy that for a dollar"
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Minor issue with one line, causes spin compile failure:
    Clock Loop wrote: »
            term.str(string(":Hours   ")
                    
    

    Simple fix:
            term.str(string(":Hours   "))             '' fixed missing ")"
    

    dgately
    Livermore, CA (50 miles SE of San Francisco)
  • Clock LoopClock Loop Posts: 1,443
    edited April 6 Vote Up0Vote Down
    dgately wrote: »
    Minor issue with one line, causes spin compile failure:
    Clock Loop wrote: »
            term.str(string(":Hours   ")
                    
    

    Simple fix:
            term.str(string(":Hours   "))             '' fixed missing ")"
    

    dgately

    Excellent catch, no idea how it slipped in. Original fixed.
    I suppose i could have made the timer code actually work by including the proper code..

    But, this was just a demo on how to format ansi command codes to a ansi compatible terminal program over telnet.... didn't want to add more complications that might confuse.. thanks again!!
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Clock LoopClock Loop Posts: 1,443
    edited April 6 Vote Up0Vote Down
    More ANSI Escape sequences
    (ANSI Escape codes)

    http://ascii-table.com/ansi-escape-sequences.php
    Esc[Line;ColumnH
    Esc[Line;Columnf 	Cursor Position:
    Moves the cursor to the specified position (coordinates).
    If you do not specify a position, the cursor moves to the home position at the upper-left corner of the screen (line 0, column 0). This escape sequence works the same way as the following Cursor Position escape sequence.
    
    Esc[ValueA 	Cursor Up:
    Moves the cursor up by the specified number of lines without changing columns. If the cursor is already on the top line, ANSI.SYS ignores this sequence.
    
    Esc[ValueB 	Cursor Down:
    Moves the cursor down by the specified number of lines without changing columns. If the cursor is already on the bottom line, ANSI.SYS ignores this sequence.
    
    Esc[ValueC 	Cursor Forward:
    Moves the cursor forward by the specified number of columns without changing lines. If the cursor is already in the rightmost column, ANSI.SYS ignores this sequence.
    
    Esc[ValueD 	Cursor Backward:
    Moves the cursor back by the specified number of columns without changing lines. If the cursor is already in the leftmost column, ANSI.SYS ignores this sequence.
    
    Esc[s 	Save Cursor Position:
    Saves the current cursor position. You can move the cursor to the saved cursor position by using the Restore Cursor Position sequence.
    
    Esc[u 	Restore Cursor Position:
    Returns the cursor to the position stored by the Save Cursor Position sequence.
    
    Esc[2J 	Erase Display:
    Clears the screen and moves the cursor to the home position (line 0, column 0).
    
    Esc[K 	Erase Line:
    Clears all characters from the cursor position to the end of the line (including the character at the cursor position).
    
    Esc[Value;...;Valuem 	Set Graphics Mode:
    Calls the graphics functions specified by the following values. These specified functions remain active until the next occurrence of this escape sequence. Graphics mode changes the colors and attributes of text (such as bold and underline) displayed on the screen.
     
    Text attributes
    0	All attributes off
    1	Bold on
    4	Underscore (on monochrome display adapter only)
    5	Blink on
    7	Reverse video on
    8	Concealed on
     
    Foreground colors
    30	Black
    31	Red
    32	Green
    33	Yellow
    34	Blue
    35	Magenta
    36	Cyan
    37	White
     
    Background colors
    40	Black
    41	Red
    42	Green
    43	Yellow
    44	Blue
    45	Magenta
    46	Cyan
    47	White
     
    Parameters 30 through 47 meet the ISO 6429 standard.
     
    Esc[=Valueh 	Set Mode:
    Changes the screen width or type to the mode specified by one of the following values:
     
    Screen resolution
    0	40 x 25 monochrome (text)
    1	40 x 25 color (text)
    2	80 x 25 monochrome (text)
    3	80 x 25 color (text)
    4	320 x 200 4-color (graphics)
    5	320 x 200 monochrome (graphics)
    6	640 x 200 monochrome (graphics)
    7	Enables line wrapping
    13	320 x 200 color (graphics)
    14	640 x 200 color (16-color graphics)
    15	640 x 350 monochrome (2-color graphics)
    16	640 x 350 color (16-color graphics)
    17	640 x 480 monochrome (2-color graphics)
    18	640 x 480 color (16-color graphics)
    19	320 x 200 color (256-color graphics)
    
    

    I have not tested all these sequences with putty, use at your own risk. (of confusion)
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Clock LoopClock Loop Posts: 1,443
    edited April 7 Vote Up0Vote Down
    And we can even generate graphics with putty and these sequences,... ANSI art.

    You can also, using putty, and either the WX device or a simple serial port, view ANS files directly with the propeller, and putty.

    Like this:
    ''*******************************************
    ''*  Telnet Wireless WX Ansi Art      Demo  *
    ''*  Author: Clock Loop @ parallax forums   *           
    ''*******************************************
    
    CON  
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
      '_xinfreq = 6_250_000 ' I do my code testing on a propscope.
              
    CON
    
      Tx             = 30   'serial out to wx device
      Rx             = 31   'serial in from wx device
    
    OBJ
    
      Term          : "FullDuplexSerialPlus" 
    
    Pub Port23AnsiArt 
    
    
      
        term.start(Rx, Tx, %0000, 115_200)                                    '1cog start telnet terminal
    
        waitcnt(80_000_000 + cnt)  
        
    
        term.str(string(27))  'Set command mode          
        term.str(string("[2J")) 'clear screen
    
      
    Repeat
    
        Repeat 5
            waitcnt(80_000_000 + cnt)
            
        term.str(string(27))  'Set command mode          
        term.str(string("[2J")) 'clear screen    
    
        term.str(string(27))  'Set command mode  
        term.str(@ansidata)
            
    
    
    DAT
    
    ansidata        File    "join.ans"
    
           
    Dat
    {{
    
      Terms of Use: MIT License
    
      Permission is hereby granted, free of charge, to any person obtaining a copy of this
      software and associated documentation files (the "Software"), to deal in the Software
      without restriction, including without limitation the rights to use, copy, modify,
      merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
      permit persons to whom the Software is furnished to do so, subject to the following
      conditions:
    
      The above copyright notice and this permission notice shall be included in all copies
      or substantial portions of the Software.
    
      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
      INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
      PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
      HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
      CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
      OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
    
    }}
    


    You can find all kinds of .ANS files here
    http://artscene.textfiles.com/

    http://pc.textmod.es

    The full code is attached which contains the join.ans file.
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Heres what the putty output looks like.

    AnsiArt.gif
    665 x 1389 - 272K
    690 x 1437 - 719K
    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Clock LoopClock Loop Posts: 1,443
    edited April 8 Vote Up0Vote Down
    You can generate your own ANSI art using ....

    Playscii
    http://vectorpoem.com/playscii/

    I generated an ANSI image of the parallax logo using it.
    But it doesn't work, so if anyone wants to figure out why the ansi files made by playscii will not work..

    The ANSI for the storm trooper was found here:

    http://blocktronics.org/artpacks/
    The Blocktronics Detention Block AA-23

    You can see rendering of the pack here
    http://pc.textmod.es/pack/blocktronics_detention_block_aa-23/

    I didn't mean to make this about ANSI stuff.

    Just showing that ANSI terminals are pretty useful with microcontrollers.


    To study the nature of randomness in a digital processor network using the same clock source, 54 prop chips were all connected to a master prop. http://forums.parallax.com/discussion/127983/55-parallax-propeller-s-parallells-processing-of-permanent-perturbations/p1
    Optic communication between homogenous and commensurable, 8-core, 635nm emitting, phase locked loop, bit salad tossing units? http://forums.parallax.com/discussion/comment/1248240/#Comment_1248240
    TheBlackBox: Release v2.0 - Propeller HSS FX/Sequencer with Digital Audio SPDIF output. http://forums.parallax.com/discussion/115258/theblackbox-release-v2-0-propeller-hss-fx-sequencer-with-digital-audio-spdif
    E-Tools - Mono555 calculator, resistor calculator, voltage divider calculator, RCtime calculator, LM317 calculator, Binary-Hex-Decimal calculator, Resistor color matrix, Series LED resistance calculator, OHMS LAW calculator.
    http://forums.parallax.com/discussion/81449/e-tools-html-java-script-electronic-design-tools-free-for-you
  • Learn has some getting started tutorials with C(maybe spin as well, I can't remember).
Sign In or Register to comment.