Serial commands!

Serial.write(argument);
Serial.println(argument);
etc.

Is there anyway to continuously send data from the pc to the computer?

Presuming you meant "from the PC to the Arduino" there are many ways. You write a program in your favorite language on the PC.

If you meant "from the Arduino to the PC", putting Serial.println() in loop() will cause it to be called Many Times Per Second.

-br

Haha, yes I'm sorry. I mean't from the PC to the Arduino. So could I write a program in C that sends data to the Arduino and then link it to the program in Arduino as a function from a library or something? How does that work?

Sorry, no linking. On the PC side you open the serial port and send characters to it. On the arduino side you read one character at a time and parse it per your application.

Lots of examples if you search around a bit.

Be aware it's necessary to delay a short while after opening the serial port to allow the arduino bootloader to time out. 2 seconds is usually enough. Otherwise the bootloader will swallow what you send and your program will appear to do nothing.

-br

Edit: If you want a ready-made receiver on the Arduino side you might check out Bitlash: http://bitlash.net

So could I write a program in C that sends data to the Arduino

Yes.

and then link it to the program in Arduino as a function

No. The PC and the Arduino are running separate programs. You can't link the Arduino sketch into your PC application. That doesn't make sense.

How does that work?

It doesn't.

That's all a bit confusing. So there is no way, in an arduino sketch, to send information from the PC to the Arduino board without having to type it into the serial monitor?

millencolin543:
That's all a bit confusing. So there is no way, in an arduino sketch, to send information from the PC to the Arduino board without having to type it into the serial monitor?

Not quite, one however could say there is no way an arduino board can send or receive information on a PC other then via serial communications via a PC comm port. So any PC application program that can be programmed to work with a comm port can talk to a arduino board. The is how the Arduino IDE's serial monitor does it.

Lefty

The serial monitor is just another program on the PC that opens and listens to the serial port and displays it on the screen. Your program will listen to the serial port and send commands. No serial monitor involved.

-br

I am very new at Arduino guys. Basically, what I'm trying to do is turn on an LED light if the arduino and PC are paired. But it seems that "there is no way to detect the bridge, only the cars on the bridge" so I am trying to continuously send data from the PC to the Arduino and then use Serial.read() to either return -1 to turn off the light, or something other than -1 to turn on the light because it is getting data from the PC. Any ideas? Be explicit please, I'm not always seeing the big picture when it comes to Arduino. And thank you

It would help to know how you are sending the data from the pc...

Normally, continuous transmission is not needed. For example, to turn on an LED on pin 13 using Bitlash, you would send:

    d13=1

and later to turn it off you would send:

  d13=0

-br

Basically, what I'm trying to do is turn on an LED light if the arduino and PC are paired.

"Paired" in what way? Sending data to the Arduino via the serial port is one way for the Arduino to detect that there is something on the other end of the serial cable. Is that what you have between the Arduino and the PC?

I'm have them connected through bluetooth. I just want an LED to tell me when they are paired, and it to turn off it i rip the dongle off the pc. In such a case, I believe I need continuous data transmission from the PC to the Arduino, but I'm not sure how to achieve this using Arduino IDE... the only way I know of to send data PC ------> Arduino is either when I'm uploading the program or when I bring up the serial monitor and type in values. In which case I can get the light to turn on as the data is sending, then it turns off again when its done.

To send data from the PC it is necessary to write a program on the PC in some PC-based targeted programming environment, not the Arduino IDE.

There are examples in the Playground for many languages.

-br

Can I get the COM3 (Arduino) and COM4 (PC) to talk to eachother using Arduino IDE? I haven't yet found a function that lets you mess with the COM ports. I know that if i do Serial functions i can go send a message from COM3 (Arduino) to COM4 (PC). Obviously the bluetooth chip on the Arduino is well aware of if it is paired with the PC. Why can't I access that and use it to turn on an LED?

Can I get the COM3 (Arduino) and COM4 (PC) to talk to eachother using Arduino IDE?

  1. The question makes no sense. COM ports don't talk.
  2. No. You must write a program in a PC-targeted IDE, not the Arduino IDE.

I haven't yet found a function that lets you mess with the COM ports.

You won't, in the Arduino IDE. You need to write a program in another IDE.

I know that if i do Serial functions i can go send a message from COM3 (Arduino) to COM4 (PC).

You can send and receive characters to any PC serial port from a program written for the PC, but not in the Arduino IDE.

Obviously the bluetooth chip on the Arduino is well aware of if it is paired with the PC. Why can't I access that and use it to turn on an LED?

This is straightforward to do once you know what you're doing talking to serial ports from the PC (in another programming environment than the Arduino IDE). Most bluetooth interfaces have a command mode. You put the module in command mode from the PC and ask for its status.

-br

Edit: too many examples to count here: Arduino Playground - HomePage

millencolin543:
I am very new at Arduino guys. Basically, what I'm trying to do is turn on an LED light if the arduino and PC are paired.

We're a page into the discussion before you mention 'pairing'.

Can you describe in detail how the PC and Arduino are connected, and what you want the Arduino to do? It sounds almost as if you want to set up a loopback at the PC between the Arduino USB COM port and a Bluetooth COM port so that you can send characters over Bluetooth and receive them back over the USB connection, and use that to detect whether the Bluetooth part of the link is connected. But this is only a wild guess, and I can't imagine how that would achieve anything useful.