A Python Library For Bitblock-Mini
Project description
Package for Bitblock-Mini
example
tests 폴더 내부의 파일을
python3 test_led.py 로 실행
pip3로 설치해야함...
콘트롤 모드
#-*-coding:utf-8-*-
from pybbmini import *
# 연결
board = BBBoard('COM18', 57600)
# ------------------------------------------
# DISPLAY
# ------------------------------------------
board.display.show(Symbol.NUM_5)
board.display.show(Symbol.CHAR_H)
symbol = '11011:11011:11011:11011:11111'
board.display.symbol(symbol)
symbol = Symbol("01010:"
"01010:"
"01010:"
"11111:"
"11111")
board.display.show(symbol)
board.display.color(Color.RED)
delay(1000)
board.display.color(Color.GREEN)
delay(1000)
board.display.color(Color.BLUE)
delay(1000)
board.display.clear()
# ------------------------------------------
# BUTTON
# ------------------------------------------
print(board.buttonA.isPressed())
print(board.buttonB.isPressed())
print(board.buttonAB.isPressed())
# ------------------------------------------
# BUZZER
# ------------------------------------------
board.buzzer.melody()
board.buzzer.tone(Note.C4, 2000)
tune = ["C4:4", "D4:4", "E4:4", "C4:4", "C4:4", "D4:4", "E4:4", "C4:4", "E4:4", "F4:4", "G4:8", "E4:4", "F4:4", "G4:8"]
board.buzzer.play(tune)
# ------------------------------------------
# TOUCH
# ------------------------------------------
board.touch0.isTouched()
board.touch1.isTouched()
board.touch2.isTouched()
# ------------------------------------------
# DigitalWrite
# ------------------------------------------
board.digitalWrite(Pin.P3, 1)
board.digitalWrite(Pin.P3, 0)
# ------------------------------------------
# DigitalRead
# ------------------------------------------
val = board.digitalRead(Pin.P0, PinMode.INPUT_PULLUP)
print(val)
# ------------------------------------------
# AnalogWrite
# ------------------------------------------
board.analogWrite(Pin.P3, 0)
# ------------------------------------------
# AnalogRead
# ------------------------------------------
val = board.analogRead(Pin.P4)
print(val)
# ------------------------------------------
# Servo
# ------------------------------------------
servo = Servo()
servo.attach(board, Pin.P3)
servo.move(100)
# ------------------------------------------
# Ultrasonic 미실장
# ------------------------------------------
us = Ultrasonic()
us.attach(board, Pin.P3, Pin.P0)
print(us.distance())
# ------------------------------------------
# Board Close
# ------------------------------------------
board.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pybbmini-1.0-py3-none-any.whl
(14.1 kB
view hashes)