SamMishal
07-06-2009, 07:38 AM
Hi All,
One the·techniques of teaching is to teach a new skill by comparing and contrasting it to an already known skill. To that end I have already posted once before a translation of a substantial program written in PBasic for the BS2 into Spin so as it would run very much in the same manner on the Propeller.
See this posting http://forums.parallax.com/showthread.php?p=818815 (http://forums.parallax.com/showthread.php?p=818815)
In this posting I am enclosing another translation of another substantial program from PBasic to SPIN.
This program however, makes use of the FullDuplexSerialPlus library object ·that appears in the PEK library. This is to help with the program action but also to introduce the BS2 programmer to the concept of Objects in SPIN.
The·benefit·of this to people learning the Propeller and Spin is that they can put the two programs side by side and be able to immediately see how the constructs they are already familiar with from their experience with PBasic and the BS2 are translated into constructs within the Spin language. I am hoping this will be an aide for people trying to learn Spin.
The program is also useful. It allows you to use a Sony IR remote control to act as a numerical Keypad for number entries. The Spin program is a translation with an additional improvement of a program given in the Stamp In Class course called “IR Remote for the Boe-Bot”. The program appears on pages 81.
http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/ProductID/322/List/1/Default.aspx?SortField=ProductName,ProductName (http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/ProductID/322/List/1/Default.aspx?SortField=ProductName,ProductName)
The Spin program has instructions at the top that should be read to understand how the program works. Also, the program should be read in light of the information given in the Course Work.
The PBasic program that appears in the book on page 81 is a culmination of techniques and routines developed in earlier chapters and gradually evolved. Therefore to appreciate the SPIN version you need to read the chapters in the book and also read the PBasic program·intently before you start reading the SPIN program. Also make sure to compare and contrast the programs in Spin and PBasic to gain the most benefit.
A future program will be one that will combine this program and the one previously posted to allow a person to select an RTTTL song from a list of songs rather than to just play all the songs in succession as it currently does.
See if you can do this before I post the solution.
I hope this will be of use .....enjoy
Samuel
Note for Spin programmers:
The program is deliberately avoiding too much use of objects to make the program more friendly to the BS2 programmer. However, the program can be made into an object. Especially the methods for emulating the BS2 commands. Note: they are based on the ones in the BS2_Functions library object but are not the same. They have been modified and the program will not work with the equivalent ones that appear in the BS2_Functions object.
One the·techniques of teaching is to teach a new skill by comparing and contrasting it to an already known skill. To that end I have already posted once before a translation of a substantial program written in PBasic for the BS2 into Spin so as it would run very much in the same manner on the Propeller.
See this posting http://forums.parallax.com/showthread.php?p=818815 (http://forums.parallax.com/showthread.php?p=818815)
In this posting I am enclosing another translation of another substantial program from PBasic to SPIN.
This program however, makes use of the FullDuplexSerialPlus library object ·that appears in the PEK library. This is to help with the program action but also to introduce the BS2 programmer to the concept of Objects in SPIN.
The·benefit·of this to people learning the Propeller and Spin is that they can put the two programs side by side and be able to immediately see how the constructs they are already familiar with from their experience with PBasic and the BS2 are translated into constructs within the Spin language. I am hoping this will be an aide for people trying to learn Spin.
The program is also useful. It allows you to use a Sony IR remote control to act as a numerical Keypad for number entries. The Spin program is a translation with an additional improvement of a program given in the Stamp In Class course called “IR Remote for the Boe-Bot”. The program appears on pages 81.
http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/ProductID/322/List/1/Default.aspx?SortField=ProductName,ProductName (http://www.parallax.com/Store/Education/KitsandBoards/tabid/182/ProductID/322/List/1/Default.aspx?SortField=ProductName,ProductName)
The Spin program has instructions at the top that should be read to understand how the program works. Also, the program should be read in light of the information given in the Course Work.
The PBasic program that appears in the book on page 81 is a culmination of techniques and routines developed in earlier chapters and gradually evolved. Therefore to appreciate the SPIN version you need to read the chapters in the book and also read the PBasic program·intently before you start reading the SPIN program. Also make sure to compare and contrast the programs in Spin and PBasic to gain the most benefit.
A future program will be one that will combine this program and the one previously posted to allow a person to select an RTTTL song from a list of songs rather than to just play all the songs in succession as it currently does.
See if you can do this before I post the solution.
I hope this will be of use .....enjoy
Samuel
Note for Spin programmers:
The program is deliberately avoiding too much use of objects to make the program more friendly to the BS2 programmer. However, the program can be made into an object. Especially the methods for emulating the BS2 commands. Note: they are based on the ones in the BS2_Functions library object but are not the same. They have been modified and the program will not work with the equivalent ones that appear in the BS2_Functions object.