0

there is a raspberry pi pico that I want to configure as a temperature sensor, and output data to zabbix

raspberry pi pico I have, connected to a computer with ubuntu 22.04 via usb, I have a code for reading the temperature, which I run in thonny and get the temperature, but the problem is that this temperature is output either to the thonny terminal or to .txt in the pico file system.

I could not find information on how to write a file.the txt file with the temperature directly to the computer or any other ways to output from raspbery Pi from pico to Zabbix

code for getting the temperature:

import machine
import utime
 
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)

temp = ()

while True:
    reading = sensor_temp.read_u16() * conversion_factor 
    temperature = 27 - (reading - 0.706)/0.001721
#    print(f'Температура: {temperature}°C')
    temp = temperature
    print(temp)
    utime.sleep(1)

thank you very much!

  • 1
    This question may yield more help over at [Raspberry PI](https://raspberrypi.stackexchange.com/) stackexchange where folks can speak to both the programming and the physical set up to help troubleshoot further. – itprorh66 Jul 08 '23 at 14:49

1 Answers1

0

If it's the Pico with WiFi, install Zabbix Agent on RaspberryPi, add a userparameter to launch python temperature.py.

Iron Bishop
  • 1,749
  • 1
  • 7
  • 16