User Tools

Site Tools


project:scd_scriptingcommanddispatcher:micropython_libraries

MicroPython : Libraries

Esp32CheckMath

Library Math mit Funktionen Add und Sub

Math.py

#
def Add(a, b):
  return a + b
#
def Sub(a, b):
  return a - b
#

Esp32CheckMath.py

#
import Math as MAT
#
print('3 + 5 = {}'.format(MAT.Add(3, 5)))			

Download: Esp32CheckMath 01v01

Esp32CheckLedSystem

LedSystem.py

#
from machine import Pin
#
class CLedSystem():
  #
  def __init__(self, pinindex):
    self.PinIndex = pinindex
    return
  #
  def Open(self):
    self.Pin = Pin(self.PinIndex, Pin.OUT)
    return 
  def Close(self):
    self.Pin = Pin(self.PinIndex, Pin.IN)
    return 
  #
  def On(self):
    self.Pin.value(1)
  #
  def Off(self):
    self.Pin.value(0);

Esp32CheckLedSystem.py

#
import time
#
import LedSystem as LS
#
LedSystem = LS.CLedSystem(2)
LedSystem.Open()
for I in range(0, 100):
  LedSystem.On()
  time.sleep_ms(100)
  LedSystem.Off()
  time.sleep_ms(100)
LedSystem.Close()	

Download: Esp32CheckLedSystem 01V01


Open Hard- & Software [ DokuWiki WebSites MediaWiki NextCloud ]

project/scd_scriptingcommanddispatcher/micropython_libraries.txt · Last modified: 2022/09/13 11:58 by 127.0.0.1