Skip to content

Commit 6ac07e7

Browse files
authored
Merge pull request #2133 from adafruit/midi_foot_pedal
update code for midi foot pedal
2 parents 94230bd + cda999a commit 6ac07e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

MIDI_Foot_Pedal/code.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
22
# SPDX-License-Identifier: MIT
33

4+
import time
45
import board
56
import usb_midi
67
import adafruit_midi
@@ -22,16 +23,16 @@ def val(pin):
2223

2324
# variables for last read value
2425
# defaults to 0
25-
# no pitchbend is 8192
2626
mod_val2 = 0
2727

2828
while True:
2929

30-
# uncomment below to print potentiometer values in the REPL
31-
# print("{}".format(mod_pot.value))
30+
# Print out the min/max values from potentiometer to the serial monitor and plotter
31+
print((mod_pot.value,))
32+
time.sleep(0.05)
3233

33-
# map range of potentiometer input to midi values
34-
mod_val1 = round(simpleio.map_range(val(mod_pot), 41200, 58500, 0, 127))
34+
# map range of potentiometer input to midi values - update the min/max values below
35+
mod_val1 = round(simpleio.map_range(val(mod_pot), 0, 65535, 0, 127))
3536

3637
# if modulation value is updated...
3738
if abs(mod_val1 - mod_val2) > 2:

0 commit comments

Comments
 (0)