We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f4f4c88 + f0398d5 commit 87c23d5Copy full SHA for 87c23d5
Trinket_Ultrasonic_Rangefinder/README.md
@@ -2,3 +2,5 @@
2
3
Code to accompany this tutorial:
4
https://learn.adafruit.com/trinket-ultrasonic-rangefinder
5
+
6
+Currently limited to M0 versions due to an issue in the Arduino IDE
Trinket_Ultrasonic_Rangefinder/code.py
@@ -81,6 +81,12 @@ def find_mode(x):
81
"""
82
n = len(x)
83
84
+ if n == 0: # If somehow there is a null array
85
+ return 0
86
87
+ if n == 1: # In trivial case of a one element array
88
+ return x[0] # just return the element as the mode.
89
90
max_count = 0
91
mode = 0
92
bimodal = 0
0 commit comments