1

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.

7
  • Can you read a serial port from Visual Studio? Oct 31, 2019 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, 2019 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. Oct 31, 2019 at 14:34
  • 1
    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, 2019 at 19:28
  • 1
    I managed to get button input into Visual Studio. It sends "A", "B" or "C" over the serial communication, that the C# program then picks up. However I want it to print only once, because with one press it prints multiple characters into serial monitor, so the messagebox that I want to show comes up multiple times.
    – taranta222
    Nov 1, 2019 at 13:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.