Error with reading and setting up voltage
2051 Views - Created 08/12/2018
>>> 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?
Can you try running one of the demo scripts in the python library demos folder? You can find a copy at https://github.com/abelectronicsuk/ABElectronics_Python_Libraries/tree/master/ADCDACPi/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".
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)
>>> read_adc_raw(1, 0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'read_adc_raw' is not defined
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.