0

I am completely new to programming, and I need some pointers where to look for a possible solution.

Currently I have been trying to get input from my Arduino buttons to Visual Studio to then do something with the input specifically.

There are three buttons setup and I want to use the input of these to control the answering for a quiz game in Visual Studio. Only one button can be pressed, then it will show a messagebox and advances to the next question. At the moment im having a hard time figuring out how to do this. Any pointers where to look is greatly appreciated.

  • Can you read a serial port from Visual Studio? – Edgar Bonet Oct 31 at 13:44
  • Yes, I have tried the excercise to control a LED using the form in Visual studio before. When I want to control physical buttons from Arduino to Visual Studio, then im not sure how to send the data over. I know that you can use portname.Readline(); so I can send strings over, but it takes everything thats printed in Serial Monitor? – taranta222 Oct 31 at 14:02
  • When you connect an Arduino to a Windows computer it adds a COM port to the devices. You still use this COM-port from your serial terminal. If you detach it from the serial terminal and write a program that opens the COM-port for reading, then you can send e.g. text messages from the Arduino to the PC (your program). I don't know what programming language you use (C#?). So I can not give you a hint how to open the port and read from it. – Peter Paul Kiefer Oct 31 at 14:34
  • If you are able to send texts to the PC, you can read this text in your program and interpret them. Of cause you must define a protocol, i.e. specify which text you send when a button is pressed and which text you send when the button is released and of cause which of the three button are pressed or released. e.g. "pA" if button 1 is pressed and "rB" if button 2 is released. – Peter Paul Kiefer Oct 31 at 14:39
  • Thanks for taking the time to help me! I am using C#. I already have setup the com port / baud / and put the portname.Open() in. I dont know if its possible or how you can make it see the difference between strings that are going through Serial Monitor. It just react to everything when using Readline in Visual Studio. Was thinking maybe assigning a "char" or "byte" to use for this, but I am not sure about it. – taranta222 Oct 31 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.