The Pin Remapping Library `dualmcu v0.0.1` for the DualMCU ONE board ensures compatibility with Arduino shields when using MicroPython.
Project description
DualMCU v0.0.1
The Pin Remapping Library dualmcu v0.0.1
for the DualMCU ONE board ensures compatibility with Arduino shields when using MicroPython.
Installation
- Open Thonny.
- Go to Tools -> Manage Packages.
- Enter
onelib
in the search bar and click Install.
Example of use
- Connect Multi-purpose Shield to DualMCU ONE
- Open Thonny and connect to the DualMCU ONE board.
- Run the following code:
from machine import Pin, PWM
from dualmcu import D5
import time
# Configuración del pin D5 para PWM
buzzer = PWM(Pin(D5))
def play_tone(frequency, duration):
buzzer.freq(frequency)
buzzer.duty_u16(32768) # Configura el duty cycle al 50%
time.sleep(duration)
buzzer.duty_u16(0) # Apaga el buzzer
try:
while True:
# Toca una secuencia de tonos
play_tone(262, 0.5) # Do
time.sleep(0.1)
play_tone(294, 0.5) # Re
time.sleep(0.1)
play_tone(330, 0.5) # Mi
time.sleep(0.1)
play_tone(349, 0.5) # Fa
time.sleep(0.1)
play_tone(392, 0.5) # Sol
time.sleep(0.1)
play_tone(440, 0.5) # La
time.sleep(0.1)
play_tone(494, 0.5) # Si
time.sleep(0.1)
play_tone(523, 0.5) # Do
time.sleep(0.1)
except KeyboardInterrupt:
# Detener el buzzer cuando se interrumpe el programa
buzzer.deinit()
- You should hear a sequence of tones.
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
File details
Details for the file dualmcu-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: dualmcu-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af64f0944841dad0465607ec3e4e5a9980c45ceebeb9f3a5bcc5fd4ec01fe78b |
|
MD5 | 1550a8de4c81dc9abdd462294ce39f9e |
|
BLAKE2b-256 | e0277b640e3966bad672334961221e7e80e8c615ce5c76024dcac4e48e234bc8 |