I am VERY NEW to programming and using Arduino so looking for assistance.
It is a simple project (in my mind) with a simple operation table. Basically, based on the status input (either active lo [ground] or active hi [more than 0]) on pins 3 & 4 will trigger active lo on pins 11 & 12 based on the following table:
#1) pin 3 - hi / pin 4 - hi = pin 11 - lo / pin 12 - lo *this will be the most common regular one
#2) pin 3 - lo / pin 4 - lo = pin 11 - hi / pin 12 - lo
#3) pin 3 - hi / pin 4 - lo = pin 11 - hi / pin 12 - hi
I also want to see about adding a 3 second delay after the pin state has changed for # 2 and # 3. For example pin 3/pin 4 are both HI and then once pin 3 or pin 4 (or both) go LO and then the pin change stops the output of pin 11 or pin 12 (or both) will hold the output for 5 seconds and then change to the state based on the input of pins 3 & 4.
So far I have the following code written:
void setup()
{
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
}
void loop()
{
if (3 == HIGH)
if (4 == HIGH)
{
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
if (3 == LOW)
if (4 == LOW)
{
digitalWrite(11, HIGH);
delay(3000);
digitalWrite(12, LOW);
delay(3000);
}
else
{
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
if (3 == HIGH)
if (4 == LOW)
{
digitalWrite(11, HIGH);
delay(3000);
digitalWrite(12, HIGH);
delay(3000);
}
else
{
digitalWrite(11, LOW);
digitalWrite(12, LOW);
}
}
When I try to run it on Tinkercad I do not get any error in the code but it does not seem to produce any output on pins # 11 & 12 based on changing the input (running a wire from GRouND pin). As I said this is the first time for me doing something like this and I do need some help or guidance. Am I making sense and heading in the right direction??