I'm new to coding. I was given a raspberry pi 4 for Christmas and I am trying to use it to make an automated sprinkler system. My problem is that I am unable to send the data from the capacitive soil sensor through my ESP32 to the Pi. I have looked at several online sources and have tried a few different methods to get my ESP32 to send the data to Pi without having any positive results. When using the lines of code below I received an error.
import time
import machine
adc = machine.ADC(machine.Pin(34))
print(adc.read())
Traceback (most recent call last): File "/home/pi/Documents/esp32 test.py", line 2, in import machine ModuleNotFoundError: No module named 'machine'
A few people on stack overflow have had similar problems with installing modules and I've tried following with pip and pip3 however these haven't moved my installation from the python2.7 directory to python3.7. I am using python3.7 because the Thonny IDE uses it and I think that the program can't find the "module named 'machine'" because it's saved to python2.7. I also tried copying the 'machine-0.0.1.dist-info' from the dist-packages of 2.7 to 3.7 but found this:
machine-0.0.1.dist-info: Error creating directory /usr/local/lib/python3.7/dist-packages/machine-0.0.1.dist-info: Permission denied
I would appreciate if someone would share their knowledge on how to move the 'machine' module to python3.7 or present a different way to get a raspberry pi 4 to communicate with an ESP32. Thanks.