Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
MicroPython-MorseCode
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
3
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Lenoir
MicroPython-MorseCode
Commits
9a9871f0
Commit
9a9871f0
authored
2 years ago
by
Olivier Lenoir
Browse files
Options
Downloads
Patches
Plain Diff
Improve pylint compliance
parent
bf768f47
No related branches found
No related tags found
1 merge request
!2
Update .gitlab-ci.yml
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
micropython/morsecode.py
+9
-12
9 additions, 12 deletions
micropython/morsecode.py
tex/GetStarted.tex
+5
-5
5 additions, 5 deletions
tex/GetStarted.tex
tex/abstract.tex
+1
-1
1 addition, 1 deletion
tex/abstract.tex
with
16 additions
and
18 deletions
.gitignore
+
1
−
0
View file @
9a9871f0
...
...
@@ -8,3 +8,4 @@
*.aux
micropython/machine.py
micropython/utime.py
This diff is collapsed.
Click to expand it.
micropython/morsecode.py
+
9
−
12
View file @
9a9871f0
...
...
@@ -9,11 +9,11 @@ Repository: https://gitlab.com/olivierlenoir/MicroPython-MorseCode
"""
from
machine
import
Pin
,
PWM
#
from machine import Pin, PWM
from
utime
import
sleep_ms
class
MorseCode
(
object
)
:
class
MorseCode
:
"""
International Morse Code
1 - The lenght of a dot (.) is one unit.
2 - A dash (-) is three units.
...
...
@@ -96,7 +96,7 @@ class MorseCode(object):
MORSE_DECODE
=
{
v
:
k
for
k
,
v
in
MORSE_CODE
.
items
()}
PROSIGN_DECODE
=
{
v
:
k
for
k
,
v
in
PROSIGN_CODE
.
items
()}
def
__init__
(
self
,
signal_pin
,
buzzer_pin
,
wpm
=
20
,
freq
=
550
,
vol
=
512
):
def
__init__
(
self
,
signal_pin
,
buzzer_pin
):
"""
signal_pin as output Pin() object
buzzer_pin as putput PWM() object
wpm as Works Per Minute based on PARIS
...
...
@@ -104,9 +104,9 @@ class MorseCode(object):
vol as a pseudo volume PWM buzzer duty-cycle
"""
self
.
signal
=
signal_pin
self
.
buzzer
=
buzzer_pin
self
.
_wpm
=
wpm
self
.
_freq
=
freq
self
.
_volume
=
vol
self
.
_wpm
=
20
self
.
_freq
=
550
self
.
_volume
=
32768
self
.
reset
()
def
send
(
self
,
msg
):
...
...
@@ -146,7 +146,6 @@ class MorseCode(object):
if
wpm
:
self
.
_wpm
=
wpm
self
.
reset
()
else
:
return
self
.
_wpm
def
freq
(
self
,
freq
=
None
):
...
...
@@ -154,14 +153,12 @@ class MorseCode(object):
if
freq
:
self
.
_freq
=
freq
self
.
reset
()
else
:
return
self
.
_freq
def
volume
(
self
,
volume
=
None
):
"""
Set or return volume
"""
if
volume
:
self
.
_volume
=
volume
else
:
return
self
.
_volume
def
_delay
(
self
):
...
...
This diff is collapsed.
Click to expand it.
tex/GetStarted.tex
+
5
−
5
View file @
9a9871f0
...
...
@@ -17,19 +17,19 @@ from morsecode import MorseCode
SGN
_
PIN = const(2)
BUZ
_
PIN = const(16)
morse = MorseCode(Pin(SGN
_
PIN, Pin.OUT), PWM(Pin(BUZ
_
PIN))
, wpm=20, vol=2
)
morse = MorseCode(Pin(SGN
_
PIN, Pin.OUT), PWM(Pin(BUZ
_
PIN)))
\end{lstlisting}
In this example, pin
\emph
{
2
}
is used for the light signal and PWM pin
\emph
{
16
}
is used for the buzzer.
\emph
{
WPM
}
\footnote
{
WPM: Words Per Minute
}
is set by default at 20 WPM and the buzzer frequency is set by default at 550 Hz.
\begin{lstlisting}
[frame=single, caption=
{
MorseCode methods
}
]
morse.freq() # get buzzer frequency
morse.freq() # get buzzer frequency
, default 550 Hz
morse.freq(550) # set buzzer frequency
morse.wpm() # get words per minute
morse.wpm() # get words per minute
, default 20 WPM
morse.wpm(20) # set words per minute
morse.volume() # get buzzer volume
morse.volume(
10)
# set buzzer volume by setting PWM.duty
_
u16
morse.volume() # get buzzer volume
, default 32768
morse.volume(
256)
# set buzzer volume by setting PWM.duty
_
u16
\end{lstlisting}
...
...
This diff is collapsed.
Click to expand it.
tex/abstract.tex
+
1
−
1
View file @
9a9871f0
...
...
@@ -6,7 +6,7 @@ Implement \emph{International Morse Code} on micro-controller using \emph{MicroP
This project is designed in pure
\emph
{
MicroPython
}
.
\begin{description}
\item
[Licence:]
MIT, Copyright
\textcopyright
{}
2021 Olivier Lenoir
\item
[Licence:]
MIT, Copyright
\textcopyright
{}
2021
-2022
Olivier Lenoir
\item
[Project:]
\url
{
https://gitlab.com/olivierlenoir/MicroPython-MorseCode
}
\item
[Documentation:]
\url
{
https://olivierlenoir.gitlab.io/MicroPython-MorseCode/MicroPythonMorseCode.pdf
}
\end{description}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment