Hi,
I need to write some software that listens to the serial port, inputs a comma delimited list of values and then graphs them.
I've looked at the SerialPort code a bit so say once i read it in I have '63,65,3,34,35,88,54cr32,33,34,43,22,23,22' any ideas on how I'd change that into #(#(63 65 3 34 35 88 54) #(32 33 34 43 22 23 22)) or where to look for hints or any code that does somethign similiar?
I wonder if there is something more advanced for graphing data than GraphMorph?
Also, how can I create a new instance of GraphMorph but give it a name or some way to reference it?
I can do New Morph > GraphMorph and get one but then I can't change it's data or whatnot. From browsing the class source I don't see any way to create a new one and have it display on the screen via code.
I was also unable to find a method that would concatenate two strings, any ideas?
Thanks for any help.
Sincerely, jsj
On 30 May 2001, J Scott Jaderholm wrote:
I've looked at the SerialPort code a bit so say once i read it in I have '63,65,3,34,35,88,54cr32,33,34,43,22,23,22' any ideas on how I'd change that into #(#(63 65 3 34 35 88 54) #(32 33 34 43 22 23 22)) or where to look for hints or any code that does somethign similiar?
| s | s := '63,65,3,34,35,88,54', String cr, '32,33,34,43,22,23,22'. out := (s findTokens: String cr) collect: [:line | (line findTokens: ',') collect: [:num | num asNumber]].
You may throw in an #asArray if the OrderedCollections returned bothers you.
I was also unable to find a method that would concatenate two strings, any ideas?
#, (see above)
You could have found this by using the Method Finder with this example: 'a'. 'b'. 'ab'
-- Bert
Bert did the first and last ones, so I'll take this one:
Also, how can I create a new instance of GraphMorph but give it a name or some way to reference it?
fred := GraphMorph new openInWorld.
Take a look at the class methods on GraphMorph, and you'll find several examples of loading a GraphMorph with data, e.g., loadSound:
Mark
-------------------------- Mark Guzdial : Georgia Tech : College of Computing : Atlanta, GA 30332-0280 Associate Professor - Learning Sciences & Technologies. Collaborative Software Lab - http://coweb.cc.gatech.edu/csl/ (404) 894-5618 : Fax (404) 894-0673 : guzdial@cc.gatech.edu http://www.cc.gatech.edu/gvu/people/Faculty/Mark.Guzdial.html
squeak-dev@lists.squeakfoundation.org