hendriawan

test_input_serial DN22D08

Oct 11th, 2023
1,574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Pin connected to latch of Digital Tube Module
  2. int latchPin = A3;
  3. //Pin connected to clock of Digital Tube Module
  4. int clockPin = A4;
  5. //Pin connected to data of Digital Tube Module
  6. int dataPin = A5;
  7. //Pin connected to 595_OE of Digital Tube Module
  8. int OE_595 = A2;
  9.  
  10. const int K1 = 12;
  11. const int K2 = 10;
  12. const int K3 = 8;
  13. const int K4 = A0;
  14.  
  15. const int INPUT1 = 2;
  16. const int INPUT2 = 3;
  17. const int INPUT3 = 4;
  18. const int INPUT4 = 5;
  19. const int INPUT5 = 6;
  20. const int INPUT6 = 7;
  21. const int INPUT7 = 9;
  22. const int INPUT8 = 11;
  23.  
  24. const int RS485_RD = A1;
  25. void setup() {
  26.   // put your setup code here, to run once:
  27.   //set pins to output because they are addressed in the main loop
  28.  
  29.   // pinMode(RS485_RD, OUTPUT);
  30.   pinMode(K1, INPUT_PULLUP);
  31.   pinMode(K2, INPUT_PULLUP);
  32.   pinMode(K3, INPUT_PULLUP);
  33.   pinMode(K4, INPUT_PULLUP);
  34.   pinMode(LED_BUILTIN, OUTPUT);
  35.  
  36.   pinMode(INPUT1, INPUT);
  37.   pinMode(INPUT2, INPUT);
  38.   pinMode(INPUT3, INPUT);
  39.   pinMode(INPUT4, INPUT);
  40.   pinMode(INPUT5, INPUT);
  41.   pinMode(INPUT6, INPUT);
  42.   pinMode(INPUT7, INPUT);
  43.   pinMode(INPUT8, INPUT);
  44.  
  45.   Serial.begin(9600);
  46. }
  47.  
  48. void loop() {
  49.   // put your main code here, to run repeatedly:
  50.   if (!digitalRead(K1)) {
  51.     Serial.println("tombol k1 ditekan");
  52.   }
  53.  
  54.   if (!digitalRead(K2)) {
  55.     Serial.println("tombol k2 ditekan");
  56.   }
  57.   if (!digitalRead(K3)) {
  58.     Serial.println("tombol k3 ditekan");
  59.   }
  60.   if (!digitalRead(K4)) {
  61.     Serial.println("tombol k4 ditekan");
  62.   }
  63.  
  64.   if (!digitalRead(INPUT1)) {
  65.     Serial.println("INPUT1");
  66.   }
  67.  
  68.   if (!digitalRead(INPUT2)) {
  69.     Serial.println("INPUT2");
  70.   }
  71.   if (!digitalRead(INPUT3)) {
  72.     Serial.println("INPUT3");
  73.   }
  74.   if (!digitalRead(INPUT4)) {
  75.     Serial.println("INPUT4");
  76.   }
  77.  
  78.   if (!digitalRead(INPUT5)) {
  79.     Serial.println("INPUT5");
  80.   }
  81.  
  82.   if (!digitalRead(INPUT6)) {
  83.     Serial.println("INPUT6");
  84.   }
  85.   if (!digitalRead(INPUT7)) {
  86.     Serial.println("INPUT7");
  87.   }
  88.   if (!digitalRead(INPUT8)) {
  89.     Serial.println("INPUT8");
  90.   }
  91. }
  92.  
Advertisement