def testADIS16460_SensorData(): # See if we can get non-zero data from ADC global URI s = adis16460(uri=URI) data = s.rx() for k in data: s = np.sum(np.abs(k)) assert s > 0
def test_adis16460_attribute_single_value(attr, start, stop, tol): global URI sdr = adis16460(uri=URI) # Pick random number in operational range nums = [] for k in range(0, 12): nums.append(2**k) ind = random.randint(0, len(nums) - 1) val = nums[ind] # Check hardware setattr(sdr, attr, val) rval = float(getattr(sdr, attr)) del sdr if abs(val - rval) > tol: print("Failed to set: " + attr) print("Set: " + str(val)) print("Got: " + str(rval)) assert abs(val - rval) <= tol
# on or directly connected to an Analog Devices Inc. component. # # THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A # PARTICULAR PURPOSE ARE DISCLAIMED. # # IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY # RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import adi import matplotlib.pyplot as plt import numpy as np from scipy import signal # Set up AD7124 adis16460 = adi.adis16460() adis16460.rx_output_type = "SI" adis16460.rx_enabled_channels = [4, 5] adis16460.sample_rate = 2048 adis16460.rx_buffer_size = 100 data = adis16460.rx() # print Y and Z axis acceleration print(data)