Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pins.ONBOARD_BTN is wired to the wrong pin #1

Open
bryancostanich opened this issue Mar 1, 2017 · 1 comment
Open

Pins.ONBOARD_BTN is wired to the wrong pin #1

bryancostanich opened this issue Mar 1, 2017 · 1 comment

Comments

@bryancostanich
Copy link
Contributor

The following code should light the onboard LED when the button is pressed because we're creating an InputPort that listens to the ONBOARD_BTN pin, however, it actually resets the board:

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware.Netduino;

namespace OnboardButtonAndLed
{
	public class Program
	{
		// An output port allows you to write (send a signal) to a pin
		static OutputPort _led = new OutputPort(Pins.ONBOARD_LED, false);
		// An input port reads the signal from a pin
		static InputPort _button = new InputPort(Pins.ONBOARD_BTN, false, Port.ResistorMode.Disabled);

		static bool _buttonPressed = false;

		public static void Main()
		{
			// turn the LED off initially
			_led.Write(false);

			// run forever
			while (true)
			{
				// set the onboard LED output to be the input of the button
				_led.Write(_button.Read());
			}

		}
	}
}

however, if I create the onboard button this way, it works:

static InputPort _button = new InputPort((Cpu.Pin)0x15, false, Port.ResistorMode.Disabled);

Evidently, this was fixed in an earlier firmware version, but regressed: http://forums.netduino.com/index.php?/topic/11844-newbie-onboard-button-in-a-program/

@bryancostanich
Copy link
Contributor Author

Fixed in 4.3.2.4Pre2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants