Arduino Diecimila, TLC5940, VB.net Serial

What I am trying to do is set leds to different colours using VB.net. I have got a program made in VB.net to send different values and have tried to make the arduino code aswell but with no luck and now looking for some help, I have been trying this for the past 3 days.

I want to send values between 0 - 5000 and text that will tell the arduino to do different things. Any info on being able to do this will help.

Thanks

Here is the lastest code I am trying to get to work. I cannot get it to take to input of "R100" or "R1000" then send that value to the TLC5940 as an led value.

#include "Tlc5940.h"

int sensorValue = 1024;
char inByte[13] = "000000000000";

int colourcode;
int colourvalue;
int rval;

void setup() {
Tlc.init();

Serial.begin(9600);
Serial.println("Arduino Setup Complete");

establishContact();
}

void loop() {
//Tlc.clear();

if (Serial.available() > 0) {

inByte[0] = Serial.read(); // read the incoming byte:
colourcode = inByte[0];

if (colourcode == 'R') {
Serial.print("RED"); // print the results:

for(int i=1; i<13; i++){
inByte = Serial.read();

_ if (inByte == -1) {_
* Serial.print(colourvalue);*
* Tlc.set(0, colourvalue);*
* Tlc.set(1, colourvalue);*
* Tlc.set(2, colourvalue);*

* i = 13;*

* }else {*
* colourvalue = int(inByte+1);*
* }*
* }*

* }else if (colourcode == 'G') {*
* Serial.print("GREEN"); // print the results:*

* }else if (colourcode == 'B') {*
* Serial.print("BLUE"); // print the results:*
* }*

* Tlc.update();*
* delay(75); // wait a bit, for serial data*
* }*
}
void establishContact() {
while (Serial.available() <= 0) {
* Serial.println("Ready"); // send a starting message*
* delay(300);*
* }*
}

First up, try and keep it simple to start with mate. You're trying to read in a number higher than a byte (255).

If I were you, I'd use a parity bit or byte key to identify the start and end of the message.

Wait until you have the "expected" number of bytes in the buffer (13 in your case.... then read it..

I'd also use the ASCII representation of 'R'...

So what I need to do is create a starting and ending byte that will allow me to know once all of the data has been sent and then use a loop to store this data into an array?

How would I get the data out of the array or split the data up so that it is a byte?

Thanks