Hey guys,
Just getting back into Arduino and I have lots of these typical fake Nano boards. I was trying to build a project when I noticed that a digital pin that was meant to be low was still leaking enough current to have an LED turn on. I booted up the 'Button' example code that comes with the IDE and even with the button turned off, the LED stays on, although it gets dimmer and flickers a bit. I've tried changing the pin the LED is on and tried a new board but the same problem persists. So all the button does is make the LED a bit brighter when pressed.
I did notice that only the pins mentioned in the code do this, so for example D6 isn't mentioned and when I plug an LED in nothing happens.
Maybe there has been an update with Arduino to stop fake boards? but I thought they were all basically the same microprocessors anyway.
So yeah ive attached the code below and was wondering if anyone could help! Thanks, Tintin.
BUT ITS NOT A CODE PROBLEM BECUASE ITS EXAMPLE CODE
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}