I would like to set a PIN LOW as default in my program, by default PIN 3 is high. And also use the PIN as input. ( I believe input is default )
Is this the code to set pin3 low? Do i have to enable the port as output to set it low?
PORTC &= ~(1 << 3); // sets PC3 low
// possible solution if I am on the right track.
DDRC |= 1 << 3; // set bit 3 of register DDRC, making PC3 an output
PORTC &= ~(1 << 3); // clear bit 3 of register PORTC, driving PC3 low
DDRC &= ~(1 << 3); // clear bit 3 of register DDRC, making PD3 an input
I think your lines of code all do what you said they would do. But at the end, you will have an input, not an output driven low. In general, your pins are either inputs or outputs, and if you are asking for both at the same time, you are probably confused about something. What would it mean to have an input that is set low?
Google “pull-down resistor” for one thing you might be thinking of. The Baby Orangutan does not have these built in, but you could add your own external pull-downs.
I got now, I didn’t need any of that code at all.