Programming ATMEGA16A PU with Arduino

Thanks for help I solved my problem ahahaah that was realy easy.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(0, OUTPUT);

pinMode(A0, INPUT);
}

// the loop function runs over and over again forever
void loop() {
if (digitalRead(A0) == HIGH) {
digitalWrite(0, LOW);
}
else {
digitalWrite(0, HIGH);
}

}
I think the processor was confused because I wrote the pins PA0 where it says A0. I guess the problem was fixed when I just typed A0. Actually, it was very simple. I'm so sorry for taking all of your precious time XD

So I have new problem this simple blinky with "if else" OKAY its works but when the "else" digital output voltage being 2,5V around.
only when i ground the analog input my digital output is 5V. how can ı fix that problem or is it normal ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.