Pymate-User-LEDs

From pymate.io wiki
Jump to navigation Jump to search


User LEDs

The as the name suggest it, the user LEDs on the Pymate are free for use.

The Pymate Board class offers access to various hardware resources like the user button, the user LEDs and the buses.

The LEDs are instances of PymateIO class. So any of the PymateIO methods also applies to the LEDs.

Pymate-Core-leds.jpg

Coding

The both LEDs are accessible via the Board.led1 and Board.led2 properties.

As the LEDs are controlled with a PymateIO class, the following PymateIO methods call also applies to the LEDs:

  • write( new_state ) : the usual PLC controlling method.
  • high() & low() : the other PLC controlling method.
  • value( new_state ) : like MicroPython Pin() does.
  • on() & off() : like MicroPython Pin also does.

The following example shows all the possibles methods controlling the Lade state.

from pymate.board import Board
import time 

brd = Board()

brd.led1.on()
brd.led2.off()

time.sleep(1)
brd.led1.low()
brd.led2.high()

time.sleep(1)
brd.led1.write(1)
brd.led2.write(0)

time.sleep(1)
brd.led1.value(0)
brd.led2.value(1)
time.sleep(1)
while True:
	brd.led1.write( not brd.led1.read() )
	brd.led2.write( not brd.led2.read() )
	time.sleep(1)



PymateIO all right reserved © 2026 - Written by MCHobby for PymateIO