system
1
I tried the run this in Realbasic(2007r5) under WinXP
Serial1.SerialPort=System.SerialPort("/COM6")
If Serial1.Open then
Serial1.Write("H")
Else
MsgBox "The serial port could not be opened."
End if
and this on the arduino (NG)
int ledPin = 13;
int val = -1;
void setup() {
pinMode(ledPin,OUTPUT);
Serial.begin(9600);
}
void loop () {
val = Serial.read();
if (val !=-1){
if (val == 'H'){
digitalWrite(ledPin,HIGH);
delay(200);
digitalWrite(ledPin,LOW);
}
}
}
It works from the serial monitor in arduino but not Realbasic any idea anybody?
system
2
I don't know realBasic, but it looks like you are just opening the port i RealBasic without specifying any paramaters for baud rate, parity etc.
What are the default values ? You should probably make sure the values match those on the Arduino board.
system
3
The baud rate is specified in the parameters for the object serial1, "serial1" is a serial object that you drop into window1.
The example your using was coded for a mac, so try
Serial1.SerialPort=System.SerialPort("\.\COM6")
If that fails, drop a list box into window1, then in the Open event handlers, add this
dim i as Integer
for i = 0 to System.SerialPortCount - 1
ListBox1.AddRow( System.SerialPort(i).Name)
next
Run the program and see which COM ports are visible in the listbox