Grundkenntnisse Programmierung 6 (Arduino Pong Spiel): Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Zeile 26: Zeile 26:


==OLED Display==
==OLED Display==
'''display.clearDisplay()''' --> all pixels are off<br>
{| class="wikitable"
'''display.drawPixel(x,y, color)''' --> plot a pixel in the x,y  coordinates<br>
|-
'''display.setTextSize(n)''' --> set the font size, supports sizes from 1 to 8<br>
|'''display.clearDisplay()'''||all pixels are off
'''display.setCursor(x,y)''' --> set the coordinates to start writing text<br>
|-
'''display.print(“message”)''' --> print the characters at location x,y<br>
|display.drawPixel(x,y, color)'''||plot a pixel in the x,y  coordinates
'''display.display()''' --> call this method for the changes to make effect<br>
|-
|'''display.setTextSize(n)'''||set the font size, supports sizes from 1 to 8
|-
|'''display.setCursor(x,y)'''||set the coordinates to start writing text
|-
|'''display.print(“message”)'''||print the characters at location x,y
|-
|'''display.display()'''||call this method for the changes to make effect
|-
|}

Version vom 29. Juni 2023, 11:43 Uhr

const

  • Das const-Keywort steht für Konstanten.
  • Das bedeutet, dass die Variable wie alle anderen Variablen des gleichen Typs benutzt werden kann, aber dass der Wert unveränderlich ist.

#define oder const

  • Für Konstanten kann entwerder const oder #define verwendet werden.
  • Für Arrays muss const verwendet werden.

unsigned long

  • Kann keine negativen Zahlen speichern.
  • Bereich liegt zwischen 0 und 4,294,967,295 (2^32 - 1)

uint8_t

UINT8_t unsigned char
U unsigned: ohne Vorzeichen
INT Integer
8 Bit länge
_t Kennung das ein Typ ist

OLED Display

display.clearDisplay() all pixels are off
display.drawPixel(x,y, color) plot a pixel in the x,y coordinates
display.setTextSize(n) set the font size, supports sizes from 1 to 8
display.setCursor(x,y) set the coordinates to start writing text
display.print(“message”) print the characters at location x,y
display.display() call this method for the changes to make effect