Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<LiquidCrystal.h>
- LiquidCrystal lcd(8,9,4,5,6,7);
- int x=0;
- int y=0;
- int z=0;
- void setup() {
- // put your setup code here, to run once:
- Serial.begin(9600);
- lcd.begin(16,2);
- }
- void loop() {
- // put your main code here, to run repeatedly:
- int ulaz=0;
- lcd.setCursor(random(0,2),0);
- while(ulaz!=1){
- lcd.print('|');
- lcd.setCursor(random(0,2),2);
- lcd.print('|');
- lcd.setCursor(random(0,2),4);
- lcd.print('|');
- lcd.setCursor(random(0,2),6);
- lcd.print('|');
- lcd.setCursor(random(0,2),8);
- lcd.print('|');
- lcd.setCursor(random(0,2),10);
- lcd.print('|');
- //ulaz=ocitaj_taster();
- //if()
- }
- while(1){
- lcd.clear();
- }
- }
- int ocitaj_taster() {
- int vr=analogRead(0);
- if(vr>1015){
- return 0;
- }
- else if(vr>630 && vr<755){
- return 1;
- }
- else if(vr>450 && vr<500){
- return 2;
- }
- else if(vr>280 && vr<350){
- return 4;
- }
- else if(vr>100 && vr<180){
- return 3;
- }
- else{
- return 5;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement