Hello!
I have written a program in Visual C++ 2005, in which I now need to set a value whether the LED on the Arduino is lighting or not. The Arduino is connected with the PC over USB.
The code for the Arduino is the following:
int ledPin = 13;
int inPin = 9;
int val = 0; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
}
void loop(){
val = digitalRead(inPin);
if (val == HIGH) {
digitalWrite(ledPin, HIGH); // turn LED off
// Serial communication that LED is off
} else {
digitalWrite(ledPin, LOW); // turn LED ON
// Serial communication that LED is on
}
}
So every time the circuit is closed, the LED is on.
My questions are now:
What do I need on the PC-Side (libraries etc.), to find out in my program whether the LED is on or off?
Which messages do I have to send from the Arduino?
Thanks for all answers!
Best regards,
Bimbo