Shop OBEX P1 Docs P2 Docs Learn Events
SPIN - Page 2 — Parallax Forums

SPIN

24

Comments

  • I think the best way to learn spin is Sphinx from @MPark.

    It's way old (about 10 years) so you have to search for it in this forum, or @publison can chime in and provide his magic to find links to older stuff here.

    It is a complete development system running on a Propeller with serial terminal or VGA and keyboard, including editor and spin-compiler.

    It is almost like being back in the 80's except you have 32 bits not 8.

    Edit, compile and run spin programs directly on the p1.

    just wonderful.

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-09-12 10:04
    If you really want to get interactive then it is never as easy as Tachyon though :)
    To print Hello World 10 times just connect a terminal and type:
    10 FOR CR PRINT" Hello World" NEXT
    

    or run a blinky on P15
    15 BLINK
    
  • ...or run a blinky on P15
    15 BLINK
    

    that is sort of mean.

    But I think that on a P2 it is be possible and desirable to have a complete Development System on it. You also work on a Editor in FORTH because it is simply tempting to be able to do that.

    Discovering the Propeller with Sphinx was almost as interactive as FORTH is, more like a TRS80/Atari/... Edit compile run.

    But I have to admit that @Mpark definitely hooked me up with the Propeller, even if I do not have any NEED for micro-controllers in my life. It just gives me a lot of fun to play around with it, compared to the more boring daily tasks I have to do to earn my living.

    But lately I do not use Spin much anymore, programming in Assembler makes more fun to me.

    Mike
  • To be perfectly honest I'm attempting to learn SPIN for the enjoyment of learning something new, plus I have dozens of projects that I could apply this to.
    When I was (much) younger I attempted assembly language and did fairly well at it, but with age comes memory loss and since I never used it I lost it.
  • Jim FouchJim Fouch Posts: 395
    edited 2017-09-17 16:21
    Here was my first SPIN project....



    It used a few of the library objects. Probably about 6-7 cogs, but was done over a weekend and about $75 in parts I had laying around.

    SPIN is an amazing language and has a ton of power.

    Now getting into assembly on the Prop can be a bit more challenging, but easier than on many other chips.

    Have fun and enjoy the experience. Don't be afraid to ask questions. This forum is full of some of the most knowledgeable and friendly people I have met.
  • Thank you Jim Fouch. You're right about the knowledgeable and friendly people on this site and I'm not even a little bit shy so I will be asking tons of questions.
    I have several hardware projects that I've been fiddling around with so now I have the ability to add software to my projects, I'm very excited. I will be choosing one this weekend then I will sit down and do a layout as to what I'm looking from my hardware and software to achieve the perfect marriage between the two. Once I achieve this I will be ready to start programming.
    This is when the questions will start flowing.... I've already thought about how I'm going to have difficulty in the actual layout of my program since I have NO programming experience. In the book that I'm practicing with they give a basic layout of the (rules) that most programmers follow, but other then those few rules I haven't the foggiest idea of how to start.
  • This looks very interesting. I'm going to try it on my data acquisition system I build a while back, (Now, where did I put everything)
  • Heater.Heater. Posts: 21,230
    ASKME,
    I haven't the foggiest idea of how to start
    This is normal.

    What you have to do is just start.

    Think of some really small simple part of whatever it is you want to do and start writing code for it.

    Then think of another part and write code for that.

    Eventually you may or may not finish the project and it may or may not work. Depending how complex it is.

    Either way, you will likely end up with an ugly, tangled mess of code that you hardly understand anymore. Is difficult to modify or add to. And probably has lots of bugs.

    With that experience you will start to see how things can be structured (laid out) better.

    Then, with your new experience, write it all again.

    As the famous software engineer Fred Brooks said:

    The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. […] Hence plan to throw one away; you will, anyhow.

    https://en.wikiquote.org/wiki/Fred_Brooks










  • Heater: I was going to ask how the best way to lay it out but you seemed to have answered my question. Plan on doing it wrong the 1st time, but hopefully I will have learned a thing or two from the experience so I will be better suited when I fail the 2nd time. I'm going to start this weekend and hopefully by Monday I will have a Smile load of questions.
  • I have a project in mind that may be a good fit. I have a Greenhouse that I would like to automate. Temperature, moisture of soil, water, fail safes, ect.
  • Heater.Heater. Posts: 21,230
    Oh, I forgot to say...

    When your project is done and dusted you may come back and look at the code again months or years later, for whatever reason. At that point you will throw your arms in the air and shout "What idiot wrote this pile of sh...". Then humbly think "Oh, it was me."

    Programming messes with your mind that way.

    The greenhouse project sounds great.

    That is already three or four sub-projects: Temperature, moisture, fail safe, etc.

    How about starting with temperature. Say. That is already three sub-sub-projects: Measuring the temperature. Making the temperature change by heating and or cooling. Creating a control system that uses the first, measurement, to drive the second, heating and cooling.

    Perhaps even four sub-sub-projects. You might want to record temperature over time so that you know the thing is working!

  • Heater: You are absolutely right. I've already been contemplating those very facts. (1) Temperature: I want to measure and display temperature. I want to turn on/off fans to circulate air depending on temperature. create a warning (alarm) if temperature is exceeded, etc. So even this first part has several sub parts.
  • Heater.Heater. Posts: 21,230
    Oh shoot, there is another sub-sub-sub project, the display.

  • I will attempt the code this weekend then I will post the failure on Monday. The beauty of it is the worst I can do is not succeed, hell that's the story of my life. If not for failure I wouldn't have a middle name.
  • Look here for code that works with a couple of the inexpensive temperature sensors:
    http://obex.parallax.com/object/837

    I helped Walt test it and recently used it to measure temperature during the eclipse.
  • Jeff Haas: Thanks for the lead and if I get really stuck I may look at it to get some ideas. I'm trying to learn SPIN and I"m not a programmer.
  • No problem. That code works with inexpensive temperature and humidity sensors, the DHT 11 and the DHT 22. Both are easy to find on eBay and Amazon and can get you started.
  • thanks Jeff
  • Saturday morning and I am now starting to attempt programming in spin language. I can already tell that this is going to be a real pain in my butt, but I'm going to give it a good college try. I was just thinking about this simple project that I picked to attempt programming with spin and realized that this little project was extremely large and it was going to require an immense amount of code to write so this should be very interesting to say the least.
  • Somebody put me out of my misery.
  • Heater.Heater. Posts: 21,230
    This page has something very worrying about it.

    Every time I load it Chrome warns me of some malware infested flash file that gets downloaded, which I always discard. It's in Jim Fouch's post above.

    Not only that, but looking at the source code to this page I see that the flash file in question is embedded in an <iframe>

    All very suspicious.

  • I don't get any warnings on this page using Firefox, but the embedded video link doesn't show anything other than just a large amount of white space were the video should be. When I look at the page source code I found the video link which doesn't look like it works and really should be this link, which does appear to work showing the project in question "Parallax Propeller used to make a Motorcycle Instrument Display".
  • ASKME,

    The LM34 has been used for years for temperature control but I see Parallax no longer carries it and the DS1620 Digital Thermometer is also being phased-out. The LM34 needs and ADC which the Activity and Education boards both have. Some of the newer sensors also have temperature measurement built in.

    A 7-segment display is not difficult to use or you could use the common 2x16 LCD.

    You can use a transistor, MOSFET, or a Relay to control a fan depending on how much power it uses.

    I don't know what legacy parts you have access to since they Spin code may already exist.

    There was a BS2 (BASIC Stamp 2) text called Industrial Control that showed how to Temperature Control.
    http://laspace.lsu.edu/aces/Document/Parallax Docs/Industrial Control.pdf
    It also uses a transistor and MOSFET to control a small PC-type fan.
  • Heater, I'm having the same issues as you
    Very strange indeed.
  • Genetix, I do have access to any and all products at Parallax, as for legacy parts I'm not sure but I will look into it.
    My goal is to write all of the code and not depending on code that someone else has written.
  • kwinnkwinn Posts: 8,697
    Heater. wrote: »
    This page has something very worrying about it.

    Every time I load it Chrome warns me of some malware infested flash file that gets downloaded, which I always discard. It's in Jim Fouch's post above.

    Not only that, but looking at the source code to this page I see that the flash file in question is embedded in an <iframe>

    All very suspicious.

    I don't get the malware warning with Firefox, but I do get a flash file download request. Definitely something odd with that post.
  • Heater.Heater. Posts: 21,230
    edited 2017-09-17 16:16
    Could Jim Fouch or a moderator pleas delete that post with the FLASH malware in it?

    Looking at the page source code I notice that a typical video link around here looks like this:
    <span class="VideoWrap"><span class="Video YouTube" id="youtube-U53pceWXLO8"><span class="VideoPreview"><a href="http://youtube.com/watch?v=U53pceWXLO8"><img src="http://img.youtube.com/vi/U53pceWXLO8/0.jpg" width="640" height="385" border="0" /></a></span><span class="VideoPlayer"></span></span></span><br />
    <br />
    
    But Jim's FLASH malware link looks like this:
    <div class="Video P"><iframe width="560" height="315" src="http://www.youtube.com/v/7_dBHsmuxuQ&rel=0" frameborder="0" allowfullscreen></iframe></div><br />
    
    Surely we don't use iframes around here? They are commonly regarded as a security problem. What is going on?

    The actual link should be:














  • Heater.Heater. Posts: 21,230
    Hmm...that's an interesting bug in the forum software. See above.

    Video links inside [code] tags get rendered inline into the code!

  • Heater. wrote: »
    Hmm...that's an interesting bug in the forum software. See above.

    Video links inside [code] tags get rendered inline into the code!

    See if Jim's original post works better now.


Sign In or Register to comment.