Hi.
Can someone explain me why goes pin (D2 for example) after defining it as INPUT automaticly to HIGH (3.3V). Im using NANO 33 BLE for AC dimmer and by zero cross detection its imposible to detect input, while the pin is high.
Could you possibly add in your code using the </> button on the reply so that people can take a look at it? Also, are you intending to detect high/low or voltage change on the input pin?
I am assuming based on your diagram that the input pin is linked to pin 5/collecter on the 4N25.
Yes, its connected to pin 5 (its working with normal NANO).
I have tested input with simple button code...
All digital pins...
Before uploading the code pin have 0V and after uploading jump on 3.3v
// constants won't change. They're used here to set pin numbers:
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);
}
}
When you say it works on a Nano do you mean that the button input code on its own or with the dimmer? Are you using this test code with the dimmer attached? Does the code make the pin go high/read high with just a button and pulldown resistor attached?
I mean with test code and nothing connected pins goes high 3.3v.
My circuit (dimmer) is the same as thease from this example and it works fine with any other arduino, just 33ble not, because pin goes automaticly high.
Can someone tell me why goes input pin to high? I have unpacked new original 33BLE, without any connection and its high. This make no sense...
Hello
I encountered the same problem, trying to make the capacitive sensing library work. after much investigations and code simplification I ended with the same understanding than you
(I also tried driving this pin low through a 4.7Mohms resistor from another pin, it doesn't work either)
I read the NRF datasheet and can't understand the behaviour, the internal pull ups are disabled by default.
I have spent hours trying to directly access the uc hardware to understand but have not succeed so far (some low level fonctions are not implemented it seeems in the libraries for the NANO 33 BLE, which makes it a nightmare. and I am quite new to the arduino world)
I can say I am very disappointed as my code was developped on the UNO and is very simple, I expected portability was not an issue
I will try the solution suggested by t6jay
Pascal