SHARE
TWEET

Untitled

a guest Dec 6th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<LiquidCrystal.h>
  2. LiquidCrystal lcd(8,9,4,5,6,7);
  3. int x=0;
  4. int y=0;
  5. int z=0;
  6.  
  7. void setup() {
  8.   // put your setup code here, to run once:
  9.   Serial.begin(9600);
  10.   lcd.begin(16,2);
  11. }
  12.  
  13. void loop() {
  14.   // put your main code here, to run repeatedly:
  15.   int ulaz=0;
  16.   lcd.setCursor(random(0,2),0);
  17.   while(ulaz!=1){
  18.     lcd.print('|');
  19.     lcd.setCursor(random(0,2),2);
  20.     lcd.print('|');
  21.     lcd.setCursor(random(0,2),4);
  22.     lcd.print('|');
  23.     lcd.setCursor(random(0,2),6);
  24.     lcd.print('|');
  25.     lcd.setCursor(random(0,2),8);
  26.     lcd.print('|');
  27.     lcd.setCursor(random(0,2),10);
  28.     lcd.print('|');
  29.    
  30.     //ulaz=ocitaj_taster();
  31.     //if()
  32.    
  33.   }
  34.   while(1){
  35.     lcd.clear();
  36.   }
  37. }
  38.  
  39. int ocitaj_taster() {
  40.   int vr=analogRead(0);
  41.   if(vr>1015){
  42.     return 0;
  43.   }
  44.   else if(vr>630 && vr<755){
  45.     return 1;
  46.   }
  47.   else if(vr>450 && vr<500){
  48.     return 2;
  49.   }
  50.   else if(vr>280 && vr<350){
  51.     return 4;
  52.   }
  53.   else if(vr>100 && vr<180){
  54.     return 3;
  55.   }
  56.   else{
  57.     return 5;
  58.   }
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top