Git Product home page Git Product logo

waveforms-sdk-getting-started-py's Introduction

Description

Demo package for the WaveForms SDK Getting Started guide and multiple test scripts for different instruments.

Check: Getting Started with the WaveForms SDK for more details.


Available tests:

  • empty test template
  • analog signal generation and recording test
  • digital signal generation and recording test
  • blinking LEDs with the Suplpies and the Static I/O instruments
  • UART in/out test using the Pmod CLS and the Pmod MAXSonar
  • SPI in/out test using the Pmod CLS and the Pmod ALS
  • I2C in/out test using the Pmod CLS and the Pmod TMP2
  • board temperature test
  • device information logging

Available instruments and functions:

Device

  • open
  • check_error
  • close
  • temperature

Oscilloscope

  • open
  • measure
  • trigger
  • record
  • close

Waveform Generator

  • generate
  • close

Power Supplies

  • switch
  • close

Digital Multimeter

  • open
  • measure
  • close

Logic Analyzer

  • open
  • trigger
  • record
  • close

Pattern Generator

  • generate
  • close

Static I/O

  • set_mode
  • get_state
  • set_state
  • set_current - UNTESTED
  • set_pull - UNTESTED
  • close

Protocol

UART

  • open
  • read
  • write
  • close

SPI

  • open
  • read
  • write
  • echange
  • spy - UNTESTED
  • close

I2C

  • open
  • read
  • write
  • echange
  • spy - UNTESTED
  • close

waveforms-sdk-getting-started-py's People

Contributors

almo8 avatar vvalmos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

waveforms-sdk-getting-started-py's Issues

static.py line 134, missing 'mask = mask.value'

In WF_SDK/static.py, calling the .set_state() method will raise operand mismatch error between the mask and shifted bits.
This can be fixed by adding mask = mask.value at line 134 just like line 68.

Power supplies not configurable using WaveForms SDK on Raspberry Pi 4

I have an Analog Discovery 2 device connected through Rasberry Pi 4. I installed the latest version of Adept Runtime(2.26.1) and WaveForms(3.18.1) on the RPi device according to the instructions here: https://digilent.com/blog/analog-discovery-2-is-now-compatible-with-raspberry-pi-4/. WaveForms app works fine via GUI interface.
But I have one issue with configure power supplies when I try to use WaveForms SDK in python scripts.
I configured the "positive" power supply to 3.3V and I tried to read state from static DIOs. I got a "LOW" state on all DIO inputs, although there should be a "HIGH" state on the DIO inputs according to my scheme.

I tried to run my script on Windows 10 and I got the expected result.

My examples can be found here:

from WF_SDK import device, static, supplies, error  # import instruments
from time import sleep  # needed for delays

try:
    # connect to the device
    device_data = device.open()
    print("Device name: " + device_data.name)

    # start the positive supply
    supplies_data = supplies.data()
    supplies_data.master_state = True
    supplies_data.positive_state = True
    supplies_data.state = True

    supplies_data.voltage = 3.3
    supplies_data.positive_voltage = 3.3
    supplies.switch(device_data, supplies_data)

    # set 9,10,11 pins as input
    static.set_mode(device_data, 9, False)
    static.set_mode(device_data, 10, False)
    static.set_mode(device_data, 11, False)

    try:
        while True:
            reading_dio9 = static.get_state(device_data, 9)
            print("DIO9: ", reading_dio9, end=' ')
            sleep(0.1)

            reading_dio10 = static.get_state(device_data, 10)
            print(" DIO10: ", reading_dio10, end=' ')
            sleep(0.1)

            reading_dio11 = static.get_state(device_data, 11)
            print(" DIO11: ", reading_dio11)
            sleep(1)

    except KeyboardInterrupt:
        # stop if Ctrl+C is pressed
        pass

    finally:
        # stop the static I/O
        static.close(device_data)

        # stop and reset the power supplies
        supplies_data.master_state = False
        supplies_data.positive_state = False
        supplies_data.negative_state = False
        supplies.switch(device_data, supplies_data)
        supplies.close(device_data)

        # close the connection
        device.close(device_data)

except error as e:
    print(e)
    # close the connection
    device.close(device.data)

Do you have any idea how to solve issue with Raspberry PI ?

dwfconstants missing definitions used in WF_SDK code

I just installed the latest version of WaveForms (3.18.1) on Windows 10, and afterwards installed the SDK through pip3 install git+https://github.com/Digilent/WaveForms-SDK-Getting-Started-PY#egg=WF_SDK.
Now, when launching Python (3.7.12) and importing the scope module via from WF_SDK import scope I get AttributeError: module 'dwfconstants' has no attribute 'DwfWindowRectangular'
I can see in the dwfconstants.py file that indeed this attribute is not present. Can either the code or the constants file be updated so that they are compatible?

Probleme with test_static-supplies.py

Hello and thank you for this work,

I want to program the IN/OUT of the Analog Discovery 2, and when I try to use your example "test_static-supplies.py", I encounter this error in static.py:

Exception has occurred: TypeError
'c_ushort' object cannot be interpreted as an integer
File "/home/douadiag/Bureau/WaveForms-SDK-Getting-Started-PY-master/WF_SDK/static.py", line 138, in set_state
if dwf.FDwfDigitalIOOutputSet(device_data.handle, ctypes.c_int(mask)) == 0:
File "/home/douadiag/Bureau/WaveForms-SDK-Getting-Started-PY-master/test_static-supplies.py", line 36, in
static.set_state(device_data, index, not(mask & pow(2, index)))
TypeError: 'c_ushort' object cannot be interpreted as an integer
**

Could you please help me resolve this error?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.