Guest User

ArduinoLCD_PC

a guest
Jun 13th, 2017
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.79 KB | None | 0 0
  1. #include <LiquidCrystal.h>
  2. LiquidCrystal lcd(12, 11, 6, 5, 3, 4);
  3. long rand1;long rand2;long rand3;
  4. char in;
  5. char v=0;
  6. int cont=0;
  7. int cont2=0;
  8.  
  9. //int Caracters1[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
  10. //int Caracters2[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
  11.  
  12. void setup() {
  13.  Serial.begin(9600);
  14.  pinMode(13, INPUT);
  15.  digitalWrite(13, 1);
  16. lcd.begin(16, 2);
  17. int Vlx1;
  18. int Vlx2;
  19.  
  20. for(int i=-1;i<16;i++){
  21.   delay(15);
  22.  rand3 = random(0,16);
  23.  lcd.setCursor(rand3, 0);
  24.  rand1 = random(2);
  25.  lcd.print(rand1);
  26.  
  27.  for(int ie=0; ie<16; ie++){
  28.    delay(20);
  29.    lcd.setCursor(ie, 1);
  30.   rand2 = random(2);
  31.  lcd.print(rand2);
  32. } }
  33. lcd.clear();
  34. }
  35. void loop() {
  36.     delay(50);
  37.          if(Serial.available()){      
  38.            in=Serial.read();
  39.  
  40.            delay(100);
  41.            
  42.          if(cont<=15){
  43.          
  44.          lcd.setCursor(cont, 0);
  45.           lcd.println(in);
  46.           Serial.print("Nun.:");
  47.           Serial.print(cont);
  48.           Serial.print("L.::");
  49.           Serial.println(in);
  50.           cont++;
  51.         }else
  52.          if(cont==16){
  53.          
  54.          
  55.        lcd.setCursor(0, 1);
  56.           lcd.println(in);
  57.           Serial.print("Nun.:");
  58.           Serial.print(cont++);
  59.           Serial.print("L.::");
  60.           Serial.println(in);
  61.           cont2++;
  62.         } else
  63.         if(cont>=16){
  64.          
  65.          
  66.        lcd.setCursor(cont2, 1);
  67.           lcd.println(in);
  68.           Serial.print("Nun.:");
  69.           Serial.print(cont++);
  70.           Serial.print("L.::");
  71.           Serial.println(in);
  72.           cont2++;
  73.         }
  74.        if(in=='*'){
  75.                lcd.clear();
  76.                cont=0;
  77.                cont2=0;
  78.             }  
  79.           }    
  80.     }
  81.        
  82.  
  83. //bem10jfx.blogspot.com
  84. https://youtu.be/AazP11JKRLc
Add Comment
Please, Sign In to add comment