This is thread is copied from the following website. It works.
https://issueexplorer.com/issue/microsoft/IoT-For-Beginners/287
Here are the steps I took for my workaround:
-
In the terminal session to the Pi within VS Code, make a backup of adc.py by typing:
sudo cp /usr/local/lib/python3.7/dist-packages/grove/adc.py /usr/local/lib/python3.7/dist-packages/grove/adc.py.bak (because… safety) -
In the terminal session to the Pi within VS Code, change the permissions on adc.py so that you can edit the file from within VS Code by typing
sudo chmod 666 /usr/local/lib/python3.7/dist-packages/grove/adc.py (This assumes you installed the python distribution patches in the same location as python3. Your mileage may vary depending on where you installed these Python packages). -
Go to the File > Open… menu to open up the Open File Or Folder dialog box.
-
Enter in /usr/local/lib/python3.7/dist-packages/grove/adc.py, then press the OK button.
-
In the adc.py file, go to approximately line 57, and change the 0x04 to 0x08 as shown below from:
def __init__(self, address = 0x04):
to: def __init__(self, address = 0x08):
-
Go to the File > Save menu to Save the adc.py file.
-
In the terminal session to the Pi within VS Code, change the permissions back on adc.py by typing:
sudo chmod 644 /usr/local/lib/python3.7/dist-packages/grove/adc.py.
Now it works!