Visual Basic for Arduino

I have an Arduino script: and need the Visual Basic 2008 Express Edition code I for it

Arduino code:

int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the data from the serial port

void setup() {
  pinMode(ledPin,OUTPUT);    // declare the LED's pin as output
  Serial.begin(9600);        // connect to the serial port
}

void loop () {
  val = Serial.read();      // read the serial port

  // if the stored value is a single-digit number, blink the LED that number
  if (val > '0' && val <= '9' ) {
    val = val - '0';          // convert from character to number
    for(int i=0; i<val; i++) {
      Serial.println("blink!");
      digitalWrite(ledPin,HIGH);
      delay(150);
      digitalWrite(ledPin, LOW);
      delay(150);
    }
    //Serial.println();
  }
}

just a GUI with a slider from 0-9, maybe

Please help me out

thanks

Throw a MSComm control on the VB form, set the properties for the MSComm to 9600,8,n,1. Add code to the vertical scrollbar for change() to send serial data.

ie:

form1.MSComm1.OUTPUT=str(form1.vscroll1.value)

I need it to be COM14 what do I have to change?

If I would add one LED that I want to turn On/Off with a button on my VB program, how would I solve that problem?

Thanks

and where do i get the MSComm control from?

thank you very much

The MSComm control is a "component" that you need to add to your toolbar. In my version of VB, it's under the Project --> Components menu.

To se it to com14, just set form1.MSComm1.CommPort=14.

ChickenVisualBasic, I think your code lacks a check for data availability on serial:

if (Serial.available()) { ...

And don't forget to put DTR to DISABLED before connecting VB to arduino, else board will reset every time you open the COM port! ;)