sketch to use RS232 shield at 2400 baud.

Hi all, I want to use an RS232 shield for Arduino to communicate serial data to an 8080 kit computer via Dsub socket at 2400 baud speed with 8 data bits, parity none, 1 stop bit, no flow control.

Can anyone advise on the code for a sketch to do this, I have looked on here and not found anything for this speed.

What is the problem ?

What happens when you use

Serial.begin(2400);

The default is 8 bits, no parity, 1 stop bit

I found this sketch and I don't know what numbers to use to set up for 2400 baud, can you tell me what numbers to define bit2400Delay and halfbit2400Delay, please.

//Created August 23 2006
//Heather Dewey-Hagborg
//http://www.arduino.cc

#include <ctype.h>

#define bit9600Delay 100
#define halfBit9600Delay 50
#define bit4800Delay 188
#define halfBit4800Delay 94

byte rx = 6;
byte tx = 7;
byte SWval;

void setup() {
pinMode(rx,INPUT);
pinMode(tx,OUTPUT);
digitalWrite(tx,HIGH);
delay(2);
digitalWrite(13,HIGH); //turn on debugging LED
SWprint('h'); //debugging hello
SWprint('i');
SWprint(10); //carriage return
}

void SWprint(int data)
{
byte mask;
//startbit
digitalWrite(tx,LOW);
delayMicroseconds(bit9600Delay);
for (mask = 0x01; mask>0; mask <<= 1) {
if (data & mask){ // choose bit
digitalWrite(tx,HIGH); // send 1
}
else{
digitalWrite(tx,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}
//stop bit
digitalWrite(tx, HIGH);
delayMicroseconds(bit9600Delay);
}

int SWread()
{
byte val = 0;
while (digitalRead(rx));
//wait for start bit
if (digitalRead(rx) == LOW) {
delayMicroseconds(halfBit9600Delay);
for (int offset = 0; offset < 8; offset++) {
delayMicroseconds(bit9600Delay);
val |= digitalRead(rx) << offset;
}
//wait for stop bit + extra
delayMicroseconds(bit9600Delay);
delayMicroseconds(bit9600Delay);
return val;
}
}

void loop()
{
SWval = SWread();
SWprint(toupper(SWval));
}

Is there any reason not to use the normal Serial functions such as begin(), available(), read(), print() and write() ?

Perhaps not, I found the sketch I posted after a search for a sketch to use a serial interface using the Max232 chip, I have ordered an RS232 shield but have not yet received it and am preparing a sketch for when I do. thanks for your reply.