[Newbies] Primitive error handling
boloomka at gmail.com
Sun Feb 7 12:45:00 UTC 2010
I have another "problem". In windows, my microchip is connected on port 7
(COM7) but I dunno which port number it is in Linux. It is connected in
location /dev/ttyUSB0 but I dunno what is its number. I have tried this code
to discover it:
n := SerialPort new.
1 to: 20 do: [:port | n openPort: port. (n isNil) ifFalse: [Transcript show:
port]. n close]
but it told me that no port after opening is nil (strange, I thought that on
Windows when I tried to open non-existing port, it returned nil). So I have
tried another code, reading string from this port by n readString and
watching when it does primitiveFailed and when doesn't. But I want only this
kind of code (but I dunno how is it named): (n readString isPrimitiveFail)
ifFalse: [Transcript show: ...]. How can I do it? Thanks for response.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners