User Tools

Site Tools


module:micropython:esp32checkmath

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
module:micropython:esp32checkmath [2021/12/08 11:27] omdevelopmodule:micropython:esp32checkmath [2022/09/13 11:58] (current) – external edit 127.0.0.1
Line 8: Line 8:
 ] ]
  
-Beispiel für die Einbindung einer uP-Library **Math.py**+===== Benutzung ===== 
 +Beispiel für die Einbindung der MicroPython-Library **Math.py** 
 +<code python> 
 +
 +def Add(a, b): 
 + return a + b 
 +
 +def Sub(a, b): 
 + return a - b 
 +
 +</code> 
 +Wichtig: Die Library muss im FileSystem des MicroControllers vorhanden sein!
  
 +Aufrufendes Programm **Esp32CheckMath.py** :
 <code python> <code python>
 +#
 +import Math as MAT
 +#
 +print('3 + 5 = {}'.format(MAT.Add(3, 5)))
 +print('3 - 5 = {}'.format(MAT.Sub(3, 5)))
 +</code>
  
 +Run-Ausgabe im Terminal:
 +<code>
 +>>> Running ..\Esp32CheckMath.py
 +>>> 
 +3 + 5 = 8
 +3 - 5 = -2
 +♦♦>
 +MicroPython v1.17 on 2021-09-02; ESP32 module with ESP32
 +Type "help()" for more information.
 +>>>
 </code> </code>
  
-Wichtig: Die Library muss im FileSystem des MicroControllers vorhanden sein! 
  
- 
-===== ===== 
 ===== Version ===== ===== Version =====
 +
 +{{:module:micropython:2112081148_esp32checkmath_01v02.zip | 2112081148_Esp32CheckMath_01v02.zip}} \\
 +{{:module:micropython:2112062054_esp32checkmath_01v01.zip | 2112062054_Esp32CheckMath_01v01.zip}}
 +
 ===== ===== ===== =====
  
module/micropython/esp32checkmath.1638959230.txt.gz · Last modified: 2021/12/08 12:27 (external edit)