Advertisement
cisco404

Kode sederhana sistem inventarisasi barang

Dec 30th, 2023 (edited)
1,440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | Source Code | 0 0
  1. // -------------------------------------------
  2. // Kode sederhana sistem inventarisasi barang
  3. // www.ardukode.blogspot.com
  4. // -------------------------------------------
  5.  
  6. // Deklarasi variabel
  7. int sensorBarcode = A2;
  8. int nilaiBarcode;
  9.  
  10. // Setup
  11. void setup() {
  12.   // Inisialisasi pin digital
  13.   pinMode(sensorBarcode, INPUT);
  14.   pinMode(D13, OUTPUT);
  15.  
  16.   // Serial monitor
  17.   Serial.begin(9600);
  18. }
  19.  
  20. // Loop
  21. void loop() {
  22.   // Baca data dari sensor barcode
  23.   nilaiBarcode = analogRead(sensorBarcode);
  24.  
  25.   // Tampilkan data ke serial monitor
  26.   Serial.print("Nilai barcode: ");
  27.   Serial.println(nilaiBarcode);
  28.  
  29.   // Tampilkan data ke LCD
  30.   lcd.print("Nilai barcode: ");
  31.   lcd.print(nilaiBarcode);
  32.  
  33.   // Delay
  34.   delay(1000);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement