Hi All,
New to the Netduino and excited to get started. I'm having a bit of trouble though. I already had a Arduino UNO and decided to go with a Netduino 2. The problem I'm having is, my circuit to run a dc motor works fine on the Arduino but when I hook it up to my Netduino it doesn't work. I think it's either my code is incorrect or maybe it's a power issue? I originally followed this tutorial for setting up my circuit for the Arduino, https://www.youtube....h?v=sOz41WQF7wE which works great.
I then hooked up my Netduino using the same pins, ground and +5v and here is my code:
public static void Main() { AnalogInput hall = new AnalogInput(Cpu.AnalogChannel.ANALOG_0); OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); InputPort switchPin = new InputPort(Pins.GPIO_PIN_D2, false, Port.ResistorMode.Disabled); OutputPort motor = new OutputPort(Pins.GPIO_PIN_D9, false); double value = 0.0; while (true) { //Do calculation to get the actual volts for an analog input value = ((hall.Read() * 1000) / 1023) * 3.3; //Take into account north/south pole magnets if (value <= 0.01 || value >= 3.17) led.Write(true); else led.Write(false); Debug.Print(value.ToString("f02")); if (switchPin.Read()) { motor.Write(true); led.Write(true); } else { motor.Write(true); led.Write(false); } } }
My led lights up when I press the button but my motor never runs.
Thanks for any suggestions .