Read the voltage from channel 2 and store it in a variable called x. Next, you must initialise the adcdac object and set a gain of 1 or 2 for the DAC: To use the ADC DAC Pi library in your code, you must first import the library: Parameters: channel - 1 or 2, value int between Set the raw value for the selected channel on the DAC Parameters: channel - 1 or 2, voltage - target DAC voltage A gain of 2 will provide a voltage between 0 and 3.3 volts. A gain of 1 will give a voltage between 0 and 2.047 volts. The DAC has two gain values, 1 or 2, which can be set when the ADCDAC object is created. Set the voltage for the selected channel on the DAC. The ADC uses the raspberry pi 3.3V power as a voltage reference, so using this method to set the reference to match the exact output voltage from the 3.3V regulator will increase the accuracy of the ADC readings. Set the reference voltage for the analogue to digital converter. Read the raw value from the selected channel on the ADC Returns: number as a float between 0 and 2.048 Parameter: mode - 0 = single-ended, 1 = differential Read the voltage from the selected channel on the ADC When the gain is set to 2, the voltage will be 0 to 3.3V Parameter: gain_factor - 1 or 2 When the gain is set to 1, the voltage range of the DAC will be 0 to 2.048V. The user LED is wired to GP25, just like on an ordinary Pico. Run with "Run Current Command" or F5 in Thonny. Download CircuitPython for Pimoroni Pico LiPo: Getting started with CircuitPython guide Pinout Other pinout-related things of note: Theres a handy interactive pinout for this board at. For example, for the ADC-DAC Pi, create a new file in thonny called ADCDACPi.py, copy contents from ADCDACPi.py into the new file, and save it onto the Raspberry Pi Pico board.Ĭreate a second file where your main program will reside and import the board library at the program's top. To install the MicroPython Library, use the Thonny Python IDE from Ĭreate a file for your chosen board and copy the contents of the python file into that board's directory. To download to your Raspberry Pi, type in the terminal: Connecting the ADC-DAC Pi Zero to a Pico Downloading and Installing the library
0 Comments
Leave a Reply. |