------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void setup() {
pinMode(10, OUTPUT);
pinMode(2, OUTPUT);
pinMode(12, INPUT);
pinMode(A0, INPUT);
}
void loop() {
analogWrite(10, analogRead(A0)/4);
if (12==HIGH)
{
digitalWrite(2, HIGH);
}
else
{
digitalWrite(2, LOW);
}
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
So this is my code. I want 2 to be the same logic as pin 12. So if pin 12 is logic 1 then pin 2 should be logic 1 and if pin 12 is logic 0 then pin 2 should be logic 0.
This doesn't work... I'd appreciate if someone could tell me where I'm going wrong with the code, I can't seem to find any similar examples. Thank you