Programmierung: Unterschied zwischen den Versionen

Aus Wiki_2020
Wezi (Diskussion | Beiträge)
Wezi (Diskussion | Beiträge)
Zeile 76: Zeile 76:
=== C ===
=== C ===
'''Arduino IDE'''
'''Arduino IDE'''
* Pi pico
*'''Pi pico'''
# [https://stackoverflow.com/questions/71327860/raspberry-pi-pico-locks-up-when-i-try-to-use-interrupts?xworks-target=blank interrupt 1]
# [https://stackoverflow.com/questions/71327860/raspberry-pi-pico-locks-up-when-i-try-to-use-interrupts?xworks-target=blank interrupt 1]
# [https://gammon.com.au/interrupts?xworks-target=blank interrupt 2]
# [https://gammon.com.au/interrupts?xworks-target=blank interrupt 2]

Version vom 1. Mai 2023, 09:50 Uhr

Git / Github

Circuitpython

Python

Codeexamples

#An example of a class
class Shape:
   def __init__(self, x, y):
       self.x = x
       self.y = y
       self.description = "This shape has not been described yet"
       self.author = "Nobody has claimed to make this shape yet"
   def area(self):
       return self.x * self.y
   def perimeter(self):
       return 2 * self.x + 2 * self.y
   def describe(self, text):
       self.description = text
   def authorName(self, text):
       self.author = text
   def scaleSize(self, scale):
       self.x = self.x * scale
       self.y = self.y * scale
#create 3 objekts of shape        
    rectangle = Shape(100, 45)  
    long_rectangle = Shape(120,10)
    fat_rectangle = Shape(130,120)
#finding the area of your rectangle:
    print(rectangle.area())
#finding the perimeter of your rectangle:
    print(rectangle.perimeter())
#describing the rectangle
    rectangle.describe("A wide rectangle, more than twice\
    as wide as it is tall")
#making the rectangle 50% smaller
    rectangle.scaleSize(0.5)
#re-printing the new area of the rectangle
    print(rectangle.area())

Tkinter

Diverse

C

Arduino IDE

  • Pi pico
  1. interrupt 1
  2. interrupt 2
  • Pointers
  1. struct&pointer
  2. Pointer 2 Structs
  3. Arduino Pointers
  4. Pointers
#include <stdio.h>
#include <stdlib.h>
int main(void) {
  int x = 5; // Integervariable
  int *ptr ; // Pointer für Int variable
  ptr = &x;  // auf Adresse von x referenzieren
  printf("x ist %d \n",x);
  printf("Die Adresse von x ist %p \n",ptr);
  printf("Der Wert x ist %d \n",*ptr);   
  return EXIT_SUCCESS;
}
/* ptr1.c */
#include <stdio.h>
#include <stdlib.h>
struct menu
{
  int item;
  char titel[5];
};
int main(void) {
int n=2;
struct menu *ptr;
ptr = (struct menu*) malloc(n * sizeof(struct menu));
printf("Die Adresse von x ist %p \n",ptr);
char i1[] = "test_1";
ptr->item = 8;
//ptr->titel = i1;
(ptr+n)->item = 10;
//int x = 5; // Integervariable
 // int *ptr ; // Pointer für Int variable
 // ptr = &x;  // auf Adresse von x referenzieren
 // printf("x ist %d \n",x);
 // printf("size of struct is %u \n",sizeof(struct menu));
printf("Der Wert x ist %d \n",ptr->item);
printf("Der Wert x ist %d \n",(ptr+n)->item);
 // printf("Der Wert x ist %d \n",menu.item);
 return EXIT_SUCCESS;
}
/* ptr1.c */
#include <stdio.h>
#include <stdlib.h>
struct menu
{
  int item;
  char titel[5];
};
int main(void) {
int n=2;
struct menu *ptr;
ptr = (struct menu*) malloc(n * sizeof(struct menu));
printf("Die Adresse von x ist %p \n",ptr);
char array[5] = "tast";
char (*arptr)[5]; // pointer 2 array
arptr = &array;   // pointer referenzieren
ptr->item = 8;
//ptr->titel = &arptr;
(ptr+n)->item = 10;
//int x = 5; // Integervariable
// int *ptr ; // Pointer für Int variable
// ptr = &x;  // auf Adresse von x referenzieren
// printf("x ist %d \n",x);
printf("i1 is %s \n",array);
printf("Der item[0] ist %d \n",ptr->item);
printf("Der item[1] ist %d \n",(ptr+n)->item);
printf("Die Adresse von aptr ist %p \n",&arptr);
printf("Die Wert an Adresse von aptr ist %s \n",*arptr);
return EXIT_SUCCESS;
}


  • Menu
  1. Menue C
  2. Embedded Menuesystem

MYSQL

Escape 
Sequence    Character Represented by Sequence
  \0         An ASCII NUL (0x00) character.
  \'         A single quote (“'”) character.
  \"         A double quote (“"”) character.
  \b         A backspace character.
  \n         A newline (linefeed) character.
  \r         A carriage return character.
  \t         A tab character.
  \Z         ASCII 26 (Control+Z).
  \\         A backslash (“\”) character.
  \%         A “%” character. 
  \_         A “_” character.