Looking to save and visualize your sensor data hassle-free? Look no further. Simply register for free to acquire your unique API key, effortlessly add your sensors, and start transmitting your data.
import urequests
def send_data(api_key, sensor_id, value):
url = 'http://iot.beno.cl/send-data.php'
response = urequests.post(url,data=(f'api_key={api_key}&sensor_id={sensor_id}&value={value}'), headers={'Content-Type': 'application/x-www-form-urlencoded'})
print (response.text)
api_key = 'YOUR_API_KEY'
sensor_id = 'YOUR_SENSOR_ID'
sensor_val = 12.34 # Replace by your sensor reading
send_data(api_key,sensor_id,sensor_val)
import requests
# Prepare the data to be sent
data = {
'api_key': 'YOUR_API_KEY',
'sensor_id': 'YOUR_SENSOR_ID',
'value': value # Replace by your sensor reading
}
# Send POST request
response = requests.post('http://iot.beno.cl/send-data.php', data=data)
print("Response status code:", response.status_code)
print("Response content:", response.content)