Shop OBEX P1 Docs P2 Docs Learn Events
P2 problems (again) — Parallax Forums

P2 problems (again)

At the risk of showing my ignorance, What's wrong with the code below? It's ben a long time since I've dabbled in Spin and I may be missing something. This is from Jon's Spin1 to Spin2 document. When I try to upload all I get is "Program has Errors".
I've tried this program and tried lighting an LED on pin 4, The LED program uploads without errors but doesn't turn on the LED.
I apologize about the code format, I just don't remember how to cut/paste it in.
I'm attempting to write the code with Spin Tools IDE on a Mac.

In closing. if any strange words appear, I took a tumble today and the meds might cause me to miss the spell checkers "always helpful" corrections. :-|

Thanks for any wisdom!!!
Amanda

v==========The Code===========v

pub main()

setup()

wait_for_terminal(true)

term.str(string("Hello, World!", 13, 13))

repeat
waitct(0)

Comments

  • maccamacca Posts: 738

    I can't help you with the code portion you have posted, since it is missing about everything... and I'm not familiar with the Spin1 to Spin2 document you are referring to.

    If you post the complete source I can take a look and see if there are errors that are not reported correctly.

    In the meantime, what version of Spin Tools IDE are you using ? Make sure you are using the latest release (see the signature).
    The IDE includes a number of examples for both P1 and P2, you can try these to familiarize with the code.

  • JonnyMacJonnyMac Posts: 8,957

    Libraries have changed do to Chip's additions to Spin2 -- my jm_fullduplexserial.spin2 library has been affected twice. I have attached an archive with an updated template and libraries.

    Unzip the file
    Save the top file to a templates folder
    Save the other Spin2 files to a libraries folder

    Try again.

    The archive includes the new version jm_fullduplexserial.spin2. Please remove old versions and replace with this one. Since I use Propeller Tool and Spin Tools IDE, I put everything into the Propeller Tools library folder and then point Spin Tools IDE to that location. Spin Tools IDE also has its own library folders.

    This is what you'll see in the updated template.

  • ajwardajward Posts: 1,129

    Thanks Jon!
    Starting this now.
    Fwiw, I'm running Spin Tools IDE on a Mac under Monterey 12.7.4.
    I've a couple of M'soft boxes running Visual Studio but mostly I'm a Mac Girl. My desk top/desk has two iMacs and an old trashcan Mac Pro. :-)

    Anyhow, many thanks (again)!!!

    Amanda

  • JonnyMacJonnyMac Posts: 8,957
    edited 2024-05-07 22:23

    Fwiw, I'm running Spin Tools IDE

    That being the case you can replace this line

      wait_for_terminal(true, 250)
    

    with

      term.tx(term.CLS)
    

    if you want to start with a clean terminal window every time. Spin Tools IDE has an internal terminal that is controlled from the IDE, hence no waiting around is required for PST to be opened and ready. In Spin Tools you can Shift-click the Run button or press Shift+F10 to run with the terminal.

    I'm glad I could help.

Sign In or Register to comment.