Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hallo Leute!

 

Ich habe mir als kleine Aufgabe, um mich in das System einzufinden, das Ziel gesetzt ein kleines Script zu schreiben, was auf dem LCD-Display(20x4) eine Laufschrift zaubert.

Nun, ich habe es fast hin bekommen, nur habe ich das Problem, das in der 1. Zeile (nur in dieser!) immer das letzte Zeichen aus dem String "auf dem Feld bleibt", also sie sollen ja eigentlich hinter der Reihe "gelöscht" bzw. auf "leer" also " " gesetzt werden.

 

Hier der Code:

[size=8pt]
def write_display_out(line, content):
laenge = len(content)
i = len(content)
text = content
n = 20
while 1:		
	if n < 0:
		content = content[abs(n):len(content)]
		lcd.write_line(line,len(content)," ")
		n = 0
	if len(content) <= 0:
		content = text
		n = 20
	lcd.write_line(line,n,content)
	n -= 1
	time.sleep(0.3)


thread.start_new_thread(write_display_out, (0, "Test 1 lalalala!",))
thread.start_new_thread(write_display_out, (1, "Und noch eine Zeile!",))
thread.start_new_thread(write_display_out, (2, "Und noch eine Zeile!",))
thread.start_new_thread(write_display_out, (3, "Und die letzte Zeile!",))
[/size]

 

Wisst Ihr woran das liegen kann bzw. wie ich das Problem lösen kann?

Danke im Vorraus! :)

Geschrieben

Du füllst erst dann mit Leerzeichen auf, wenn n < 0, wenn also der Text links anfängt rauszuscrollen. Das geht wenn der Text 20 Zeichen oder länger ist. Dein Text für die erste Zeile ist kürzer als 20 Zeichen, alle anderen sind länger. Daher tritt das Problem nur bei der ersten Zeile auf.

Geschrieben
  • Autor

Oh man..

Ich hab alles nachgeschaut, aber darauf bin ich nicht gekommen..

Danke! :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.