Skip to content

Update slider #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2021
Merged

Update slider #16

merged 2 commits into from
May 26, 2021

Conversation

caternuson
Copy link
Contributor

Removes a left over serial print, but also changes the actual slider logic. With rounding to first decimal place there was a jump from 0.2 to 0.4 and 0.6 to 0.8. The slider has 9 possible "positions", which leads to increments of 1/8th:

1 0.000
2 0.125
3 0.250
4 0.375
5 0.500
6 0.625
7 0.750
8 0.875
9 1.000

So, instead of rounding, return the slider value with 1/8th increments.

Test code:

import time
from adafruit_funhouse import FunHouse

fh = FunHouse()

while True:
    s = fh.peripherals.slider
    if s is not None:
        print(s)
        time.sleep(0.1)

Output:

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit FunHome with ESP32S2
>>> import test_slider
1.0
1.0
1.0
0.875
0.75
0.625
0.625
0.625
0.5
0.5
0.375
0.375
0.375
0.25
0.25
0.25
0.125
0.125
0.125
0.125
0.0
0.0
0.0

@caternuson caternuson requested a review from makermelissa May 26, 2021 01:05
Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@caternuson caternuson merged commit fc053ec into adafruit:main May 26, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 4, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.8.4 from 1.8.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_seesaw#69 from jfurcean/add-rotaryio-docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.11.5 from 2.11.4:
  > Empty commit - related to main switch
  > Moved default branch to main
  > Moved CI to Python 3.7
  > Added help text and problem matcher
  > Added pull request template

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.10.2 from 1.10.1:
  > Moved default branch to main
  < Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#34 from bjnhur/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Dash_Dis to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Dash_Dis#1 from jposada202020/improving_docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_FunHouse to 2.1.3 from 2.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_FunHouse#16 from caternuson/slider

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_Simple_Text_Display
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants