Communicating with Arduino from a Computer

Hi all, for starters, I have a strong programming background but am trying to learn a bit more about circuitry/microcontrollers, so this is my first experience with Arduino (I know very little so far).

I have a project where I want to basically have a laptop connected to an arduino board, and be able to communicate between the two. For example, I want the laptop to be able to send commands to the arduino board to do things like drive a servo. I'd also like to be able to get data back from the arduino board - for example, if I have a temperature sensor, I'd like the computer to be able to read it. Thus this isn't an entirely standalone arduino project.

My main questions - * Does anyone have any useful links or information on how this can be accomplished? Any similar projects people have blogged/written about, etc * How can I communicate between the two? Can I use the usb port, and is there a driver on the computer side that works on Windows that I can use to call into the arduino board, etc?

I'm fine with reading so would greatly appreciate any useful links. Thanks!

There are many choices in this area. My personal favorite is python. With the PySerial library its easy to talk to the arduino http://arduino.cc/playground/Interfacing/Python

This is my code for sending the time in a packed value to the arduino. It also waits for the arduino to ask for the time. This is a very simple example and you don't have to use python.

import serial, sys, os, time, struct, datetime

SERIALPORT = "COM2" # Change this to your serial port!
day = 0

def packIntegerAsULong(value):
        return struct.pack('I', value)

try:
    ser = serial.Serial(SERIALPORT, 9600)
except serial.SerialException:
    print "no device connected - exiting"
    sys.exit()

while 1 == 1:
    now = datetime.datetime.now()
    day2 = now.day
    dst_adj_time=time.time()-time.altzone
    if time.localtime().tm_isdst==0:
        dst_adj_time=dst_adj_time-3600
    if day2!=day:
        ser.write('6')
        ser.write(packIntegerAsULong(int(dst_adj_time)))
        print time.ctime()
        day = now.day
    if ser.inWaiting(): 
        outinit = eval(ser.readline())
        if outinit==1001:
            ser.write('6')
            ser.write(packIntegerAsULong(int(dst_adj_time)))
            print time.ctime()

You can check : Processing. http://www.processing.org. It can do both ways. Just program it. I did a few experiments with Processing and Arduino. Just basic - "hello word"

There is agood youtube tutorial series for the arduino made by jeremy blum...in part 6 it talks about serial processing...you can have a look, maybe it will help :)

http://www.youtube.com/watch?v=g0pSfyXOXj8