Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Serial Ports in RealBasic in OS X

Serial Ports in RealBasic in OS X
Thread Tools
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Jul 29, 2002, 11:57 AM
 
Hi,

I'm using realbasic 4 in os x, but in the serial class, it only shows Modem Port and Printer Port. However, I have os x and have none of these, just a usb-serial adpater with drivers. How can I make realbasic talk to other serial devices, such as my usb serial port?

Thanks!
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jul 29, 2002, 02:18 PM
 
You can enumerate them programmatically, I think.
     
Junior Member
Join Date: Jan 2002
Location: Geelong Australia
Status: Offline
Reply With Quote
Jul 30, 2002, 07:54 AM
 
Below is some of my robot control code, you can see the listed number of serial ports and their numbers in listbox "SPreportLB" then open the one you want with "Serial1.port = 1
connected = Serial1.open" (serial port number one in this case!)

Its easy once you get some example code,

Email me if you have any problems,

mullins@deakin.edu.au

Dim serialPortNum As Integer
Dim i As Integer
dim connected as boolean


// Get the number of serial ports available
serialPortNum = System.SerialPortCount

// Show the number of Serial Ports
SPreportLB.AddRow ""
SPreportLB.Cell(SPreportLB.LastIndex,0) = "Number of Serial Ports: " + Str(serialPortNum)

// Loop through the available serial ports
For i = 0 To serialPortNum - 1
// Add a line for each serial port
SPreportLB.AddRow "Serial Port " + Str(i)+ " ="
SPreportLB.Cell(SPreportLB.LastIndex,1) = System.SerialPort(i).Name
Next



Serial1.port = 1
connected = Serial1.open

if connected then
DisplayField.text=DisplayField.text+"Robot Online"+chr(13)




else
msgBox "There is a problem connecting to the current serial port."
end
Windows: Been There Done That , Why go Back?
MAC
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:16 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2