Go Down

Topic: 2 inputs from visual studio to arduino (Read 111 times) previous topic - next topic

Andrija24

May 16, 2019, 11:55 am Last Edit: May 16, 2019, 01:04 pm by Andrija24
Hi, I have one question.
How I can get action from button on arduino in my visual studio windows form app in c#?
I search all things, but I did not found anything about that. I use Standard Firmata for communicate with arduino.

blh64

Firmata is a protocol for sending messages to your Arduino.  You want to send a message TO your app on your PC.  Why not just use Serial?  Search the forum for "How to reliably send data" for a good overview.  Bascilly, your C# app needs to open the COM port and read whatever the Arduino is sending.

Andrija24

Can I take example of code for this solution?

UKHeliBob

Can I take example of code for this solution?
Code: [Select]

const byte buttonPin = 10;

void setup()
{
  Serial.begin(115200);
  pinMode(buttonPin, INPUT_PULLUP);
}

void loop()
{
  if (digitalRead(buttonPin) == LOW)
  {
    Serial.println("a message");
  }
}
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Andrija24

#4
May 17, 2019, 09:30 am Last Edit: May 17, 2019, 09:32 am by Andrija24
I know code for Arduino software. Can you give me a code for c# app?
Because, I must on button click use function for print.

UKHeliBob

Quote
Can you give me a code for c# app?
You would almost certainly be better asking that question in a forum devoted to C# don't you think ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Andrija24

I asked them, but they ansever me that I ask on Andruino Forum for this problem.

UKHeliBob

What did you ask them ?

The C# program is going to receive serial input.  You decide what exactly is sent to the program when the button is pressed on the Arduino and what is sent when the button is not pressed or is released.  The C# program does not need to know, nor does it matter, where the serial input comes from, all it needs to do is to receive and interpret the serial input.  That is a question about C#, not the Arduino
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up