Arduino Due digitalread is always I

Hey
I think i have got a problem with my due and i dont know why. I was trying to run the digitalread example. But in any case, even if there is not any connection to my digitial I/O pins, the state is 1.
Of course i have used 3.3V since its a due. Iam quite a noob so be kind please.

mfg Oklox

But in any case, even if there is not any connection to my digitial I/O pins, the state is 1.

You should never leave an input unconnected it can show anything. Try connecting it to ground and then read it.
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

To expand on Grumpy_Mike's response, I would suggest that while testing, you connect any digital-inputs to ground through a resistor.

The resistor should be no less than 1100 Ohms. This protects the pin on the SAM chip in case the pin that you are connecting is inadvertently programmed as an OUTPUT and you connect it to ground (mistakes do happen). Do note that DIO pins default to INPUT at power-up, and they must be programmed as OUTPUT in code.

However, the good old resistor will still prevent sparks when you accidentally ground the power supply pins, instead of the intended DIO pins. Not that I've ever done that :-/

I keep some pre-soldered resistors with leads handy for this type of thing.

Possible exception: Arduino Pins 20 & 21 (SAM Ports B.12 & B.13), which are pulled-UP on the Arduino PCB with 1000 ohms to 3.3V. Using a 1100-Ohm pull-DOWN on these pins may give unreliable results (these are designated as I2C pins). However, nothing will be harmed.

Why 1100-Ohms?: The 'weakest' pins on the SAM chip are spec'd to be able to source 0.003Amps maximum. 3.3V / 0.003A = 1100 (Ohms).
(I am using 3.3V here as a worse-case number, the actual voltage output by a digital-output pin will be a bit less)

Good luck,

-Chris

Thank you!

Really helped me out