Hack Forums
[C#] Simple arduino DC motor, - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] Simple arduino DC motor, (/showthread.php?tid=5314449)



Simple arduino DC motor, - Coffee is love - Jun 22, 2016

How do I make it so in the serial monitor I can type start or stop and have a dc motor spin or not spin lol, I see 200 million tutorials everywhere that are like hook up IC's and diode's and everything in existence just to have a DC motor turn on and off none that are like type start in serial to tell the arduino to turn that on.. nothing like that for some reason.


* - Zilog80 - Jun 22, 2016

#200,000,001 tutorial:

http://www.letsarduino.com/project-22-arduino-c-servo-motor-control-serial-communication/


* - Coffee is love - Jun 22, 2016

but that has a separate C# program.. do I not need to use that?


* - Chappie - Jun 22, 2016

If you are talking about communicating through serial ports, I made a tutorial here on HF quite a while ago.

https://hackforums.net/showthread.php?tid=2051683

Is this what you are looking for?


* - Oliver Sykes - Jun 23, 2016

Well, I mean, the only lines of real importance that I see in the c# are the following:
Code
serialPort1.Open();
//and
byte[] b = BitConverter.GetBytes(PWM);
                serialPort1.Write(b, 0, 4);
As far as I can tell, most of the rest is for the GUI, but I've never really messed with Arduinos, so eh.


* - Coffee is love - Jun 23, 2016

YES Peefer, that is what I mean't lol I had the rest down just didn't know how to be like hey light1 via serial to have it work


* - Chappie - Jun 23, 2016

(Jun 23, 2016 05:00 AM)Coffee is love Wrote:  YES Peefer, that is what I mean't lol I had the rest down just didn't know how to be like hey light1 via serial to have it work

Glad to help!