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

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


==uint8_t==
==uint8_t==
'''UINT8_t''' --> unsigned char<br>
'''U''' --> unsigned  ohne Vorzeichen<br>
'''INT''' --> Integer<br>
'''8''' --> Bit länge<br>
'''_t''' --> Kennung das ein Typ ist
{| class="wikitable"
{| class="wikitable"
|-
|-
!'''UINT8_t'''!!unsigned char
|'''UINT8_t'''||unsigned char
|-
|-
|'''U'''||unsigned: ohne Vorzeichen  
|'''U'''||unsigned: ohne Vorzeichen  

Version vom 29. Juni 2023, 11:41 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