Author Options:

Controlling multiple Arduino pins in VB or C#? Answered

How do I control different pins of an Arduino via VB or C#. Something simple, for instance; if I created 4 buttons. Button 1 would turn ON pin 13, button 2 would turn OFF pin 13. Button 3 would turn ON pin 12 and button 4 would OFF pin 12. I know that it works via a serial port, but I can only control 1 pin. Simple stuff, but I just can't figure it out. PLEASE HELP!!!!

3 Replies

steveastroukBest Answer (author)2012-02-14

Send a character. Decode the character. If the character is a "A" Turn on Pin 13, if its a "B" turn on Pin 12. Wait for next character. If character is an "A" Turn off pin 13 etc etc.


Select as Best AnswerUndo Best Answer

drdunc1000 (author)2012-02-14

make an array in Arduino with the contents holding the pin numbers of outputs you want to change. On the VB side, send two characters - the first being the index number (0,1,2...etc) and the second a T or an F. On the arduino side receive the two characters and use the index to find which pin to change and the T/F to turn it on or off

Select as Best AnswerUndo Best Answer

iceng (author)2012-02-13

Show your code so far.

Otherwise I think you confused pin numbers with port numbers,
give it a good look see.


Select as Best AnswerUndo Best Answer