Hi @Jungle Jim,
Based on your comments, you encountered following errors listed below.
So, the first error you encountered was due to the wifi library not included in the initial code. When you included it #include wifi.h , it helped resolved this issue. However, then you encountered HTTP Error Code -301 which indicates a "Moved Permanently" response from the server and suggests that the URL used for the HTTP request is incorrect or outdated. The ThingSpeak API endpoint may have changed, or the request may not be formatted correctly. So, I would recommend the following to the issues. First, make sure the line #include wifi.h is present at the top of your code. Modify the httpRequest function to make sure the correct endpoint is used and writeAPIKey is correctly set and valid. An invalid API key will also lead to errors when trying to update the channel. Now, if you want to write fields securely, consider using the HTTPS library. You may need to include the WiFiClientSecure.h library and modify the connection method to use SSL. Here is an example of how to modify the httpRequest function for secure connections based on the documentation provided below.
https://www.mathworks.com/help/thingspeak/measure-arduino-wifi-signal-strength-with-esp32.html
Please let me know if the code provided in the link above resolves your problem.