Error with reading and setting up voltage
The ADC-DAC Pi Zero is a 2 Channel ADC and 2 Channel DAC for the Raspberry Pi
08/12/2018
Posted by:
fredsharifi
>>>> adcdac.set_adc_refvoltage(3.3)
>>> set_dac_voltage(1, 3.3) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'set_dac_voltage' is not defined".
although the procedure is defined in the ADCDACPi.py , How do I test the program to know if its communicating with the board?
Thank you
08/12/2018
Posted by:
andrew
Can you try running one of the demo scripts in the python library demos folder? You can find a copy at ADC DAC Pi demos
If the demos fail to run then you may need to go through our SPI tutorial to make sure the SPI bus is configured correctly.
One reason for the code failing with the "not defined" error could be that the ADCDACPi.py library can not be found by your code. Try putting ADCDACPi.py in the same folder as your code and import it with "from ADCDACPi import ADCDACPi".
08/12/2018
Posted by:
fredsharifi
https://github.com/abelectronicsuk/ABElectronics_Python_Libraries/tree/master/ADCDACPi
the import instruction is working fine, the mode instruction is working fine, setting up max ref voltage works fine, only when trying to read or write is where I get the error, the SPI interface is set to enable, I solder the pin header and nothing else, and plug into the IO Pin socket.
here is the copy of the python command line interface:
>>> from ADCDACPi import ADCDACPi
>>> adcdac = ADCDACPi(2)
>>> adcdac.set_adc_refvoltage(3.3)
>>> read_adc_raw(1, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'read_adc_raw' is not defined
08/12/2018
Posted by:
fredsharifi
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.