Jump to content

Shuddi

Members
  • Gesamte Inhalte

    3
  • Benutzer seit

  • Letzter Besuch

Posts erstellt von Shuddi

  1. Ja, vermutlich bin ich Betriebsblind oder sowas in der Art..

     

    Ende beim normalen run ist der..

     

    lcd.writeLine((short)0, (short)2, "Hallo!");

    lcd.writeLine((short)1, (short)2, "1. Starten");

    lcd.writeLine((short)2, (short)2, "2. Beenden");

    lcd.writeLine((short)1, (short)0, "");

    lcd.setConfig(false, true);

     

    ..mehr tut sich dann nicht mehr.

     

    public static void main(String args[]) throws Exception {
    	try{
    		IPConnection ipcon = new IPConnection(); // Create IP connection
    		BrickletLCD20x4 lcd = new BrickletLCD20x4(UID, ipcon); // Create device object
    
    		ipcon.connect(HOST, PORT); // Connect to bricked
    		lcd.clearDisplay();
    		lcd.backlightOn();
    
    		lcd.writeLine((short)0, (short)2, "Hallo!");
    		lcd.writeLine((short)1, (short)2, "1. Starten");
    		lcd.writeLine((short)2, (short)2, "2. Beenden");
    		lcd.writeLine((short)1, (short)0, "");
    		lcd.setConfig(false, true);
    
    
    		// Add button pressed listener
    		lcd.addButtonPressedListener(new BrickletLCD20x4.ButtonPressedListener() {
    			public void buttonPressed(short button) {
    				System.out.println("Button Pressed: " + button);
    					switch (button){
    						case 0: BUTTON0 = true; break;
    						case 1: BUTTON1 = true; break;
    						case 2: BUTTON2 = true; break;
    						case 3: BUTTON3 = true; break;
    					}
    			}
    		});
    
    		//Schleife
    		while(EXIT != true){
    
    			//runter
    			if(BUTTON2 == true){
    				cursor++;
    
    				if(cursor > 2){
    					cursor = 1;
    				}
    
    				lcd.writeLine((short)cursor, (short)0, "");
    				BUTTON2 = false;
    			}
    
    			//rauf
    			if(BUTTON1 == true){
    				cursor--;
    
    				if(cursor < 1){
    					cursor = 2;
    				}
    
    				lcd.writeLine((short)cursor, (short)0, "");
    				BUTTON1 = false;	
    			}
    
    			//OK 
    			if(BUTTON3 == true){
    				switch(CursorPosition(cursor)){
    					case 1: BUTTON3 = false; cursor = 1; RunPennyBank(lcd); break;
    					case 2: EXIT = true; BUTTON3 = false; break;
    					default: break;
    				}
    			}
    
    			//Beenden
    			if(BUTTON0 == true){
    				EXIT = true;
    			}			
    		}//while
    
    		lcd.clearDisplay();
    		lcd.backlightOff();
    		System.out.println("Press key to exit"); System.in.read();		
    		ipcon.disconnect();
    	}//try
    	catch(Exception e){
    		System.out.println("Exception"); System.in.read();		
    
    	} //catch	
    }//main
    

  2. Hi,

     

    ich habe folgendes "Problem":

     

    Ich habe einen Masterbrick mit einem LCD 20x4 Bricklet und kann mein Programm aus mir unerfindlichen Gründen nur im Debug-Modus ausführen.

     

    Grundsätzlich besteht mein Programm nur aus Textausgabe aufs Bricklet und einem ButtonPressedListener der auf Tastendruck den Cursor bewegen soll.

     

    Im Debug-Modus funktioniert soweit alles.. aber sobald ich das Programm normal ausführen will (mit Eclipse aber auch mit javac über die Konsole), wird der Tastendruck zwar erkannt (Ausgabe auf Konsole) aber sonst passiert nix.  :-\

     

    Hat von euch evtl. jemand eine Idee?

     

    Danke schonmal und LG

     

×
×
  • Neu erstellen...