Arduino to VB.Net

Hi guys .
Can you help me to make my arduino code connects to my vb.net program :slight_smile:

const int buttonPin = 2;
const int buttonPin1 = 4;
const int buttonPin2 = 6;
const int ledPin = 12;// the number of the pushbutton pin
const int ledPin1 = 13;
const int ledPin2 = 11;
// the number of the LED pin

// variables will change:
int buttonState = 0;
int buttonState2 = 0;// variable for reading the pushbutton status
int buttonState3 = 0;

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);   
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);  
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT); 
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);  
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin, HIGH);  
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW); 
  }
  buttonState2 = digitalRead(buttonPin1);
  if (buttonState2 == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin1, HIGH);  
  } 
  else {
    // turn LED off:
   
    digitalWrite(ledPin1, LOW); 
  }
  buttonState3 = digitalRead(buttonPin2);
  if (buttonState3 == HIGH) {     
    // turn LED on:    
    digitalWrite(ledPin2, HIGH);  
  } 
  else {
    // turn LED off:
   
    digitalWrite(ledPin2, LOW); 
  }
  
}

Thanks for your future help :slight_smile:

Needs more detail.

However, you can make your VB.net program talk to the Arduino over serial - just figure out which COM port it's using. The rest is just details :wink:

your previous post on this topic

The example C# program which can be simplified and converted to VB.NET

That program is written such that the Arduino monitors the serial port and responds to a query from the PC.
Instead of sending back the canned message, you respond with the states of your LEDs.