LOGIN
Awais Khawar
Btech Electronic and Telecom is in progress
 · PeshawarPakistan
Edit
Delete
Share
Report
TASK
Open
  ·  Close Task

according to this truth table i make this program.if truth table is wrong then i will modified the code of reciever

#arduino

int switchPin[] = {2,3,4,5}; 
int ch1 =  6;
int ch2 =  7;
int ch3 =  8;
int ch4 =  9;

 void setup()
 {


  pinMode(switchPin[0], INPUT);
  digitalWrite(switchPin[0], HIGH);
  pinMode(switchPin[1], INPUT);
  digitalWrite(switchPin[1], HIGH);
  pinMode(switchPin[2], INPUT);
  digitalWrite(switchPin[2], HIGH);
  pinMode(switchPin[3], INPUT);
  digitalWrite(switchPin[3], HIGH);
   pinMode(switchPin[4], INPUT);
  digitalWrite(switchPin[4], HIGH);
 pinMode(ch1, OUTPUT);//Pino digital saída do Arduino(4-ch1);
 pinMode(ch2, OUTPUT);//Pino digital saída do Arduino(5-ch2);
 pinMode(ch3, OUTPUT);//Pino digital saída do Arduino(6-ch3);
 pinMode(ch4, OUTPUT);//Pino digital saída do Arduino(7-ch4);
 }

 void loop()
{
  if (digitalRead(switchPin[0]) == HIGH)
  {  // switch is pressed - pullup keeps pin high normally
       digitalWrite(ch2, LOW) ;
     digitalWrite(ch3, LOW) ;  // toggle running variable
  } else
       {
        digitalWrite(ch2, HIGH) ;
     digitalWrite(ch3, HIGH) ; // indicate via LED
  }
  
    if (digitalRead(switchPin[1]) == HIGH)
  {  // switch is pressed - pullup keeps pin high normally
       digitalWrite(ch2, LOW) ;  // toggle running variable
  } else
       {
       digitalWrite(ch2, HIGH)  ; // indicate via LED
  }
  if (digitalRead(switchPin[2]) == HIGH)
  {  // switch is pressed - pullup keeps pin high normally
       digitalWrite(ch3, LOW) ;  // toggle running variable
  } else
       {
       digitalWrite(ch3, HIGH)  ; // indicate via LED
  }
    if (digitalRead(switchPin[3]) == HIGH)
  {  // switch is pressed - pullup keeps pin high normally
       digitalWrite(ch4, LOW) ; 
      digitalWrite(ch1, LOW) ; // toggle running variable
  } else
       {
       digitalWrite(ch4, HIGH)  ;
      digitalWrite(ch1, HIGH) ;  // indicate via LED
  }
 
 

 delay(0);
}
2 likes 
Like
Share
Steven Reubenstone
Mechanical Engineer & Collaborizm Mentor. Join our iOT Hackathon!
 · New YorkU.S.
Edit
Delete
Share
Report

Awais Khawar excellent and highly impressive Arduino contribution here.

1 like 
Awais Khawar
Btech Electronic and Telecom is in progress
 · PeshawarPakistan
Edit
Delete
Share
Report

thanks man

0 like 
Steven Reubenstone
Mechanical Engineer & Collaborizm Mentor. Join our iOT Hackathon!
 · New YorkU.S.
Edit
Delete
Share
Report

Mohana Prabhakar how are you doing?

0 like 
Leave a reply...
DISCOVER
CHAT
ALERTS
-2
DISCUSSIONS
-1
FEED