Pico W Micro Python MQTT of data to a RP4B

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Pico W Micro Python MQTT of data to a RP4B

Post by Rissy » Wed Aug 17, 2022 7:43 am

Rissy wrote:
Tue Aug 16, 2022 5:37 pm

Interestingly enough, you'll see I had to publish my messages to the opposite way around to how they're displayed on-screen to get them to appear in that same order on my phone as on the screen.

Can anyone answer me to why this should be? Weird one!

===================

Speaking of LEDs. Is there a clever way to flash the LED at intervals (maybe once a minute or ever 30 secs perhaps) during the end time.sleep() at the bottom of the code because i'll eventually be pushing that time.sleep() up to 900 (every 15 mins) to match the reading interval of my other readings being measured at my RP4B.

It would be nice to be able to look at the Pico W and see a regular "heartbeat" to confirm it's still alive and working, and then do the more lengthy flashing routine I have it doing as it is transmitting data to my Pi.
Is anyone able to help with information about my remaining questions here?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Pico W Micro Python MQTT of data to a RP4B

Post by jimmo » Wed Aug 17, 2022 11:51 am

Rissy wrote:
Wed Aug 17, 2022 7:43 am
Is anyone able to help with information about my remaining questions here?
If you're using asyncio, then just create a task that does

Code: Select all

import uasyncio as asyncio

async def heartbeat(led):
  while True:
    await asyncio.sleep_ms(29900)
    led.on()
    await asyncio.sleep_ms(100)
    led.off()
Otherwise you can use a timer. On rp2040 / pico you can use a soft timer.

Code: Select all

import machine

def start_heartbeat(led):
  def on(_):
    led.on()
    tim_off = machine.Timer(-1, mode=machine.Timer.ONE_SHOT, period=100, callback=lambda _: led.off())

  tim_on = machine.Timer(-1, mode=machine.Timer.PERIODIC, period=30000, callback=on)

danjperron
Posts: 51
Joined: Thu Dec 27, 2018 11:38 pm
Location: Québec, Canada

Re: Pico W Micro Python MQTT of data to a RP4B

Post by danjperron » Wed Aug 17, 2022 12:21 pm

I think you'd have to identify the low power bits of the code to me before I'd have any chance of trying that out with my setup.
You could supply Vsys with a voltage bettween 1.8 to 5.5V which is perfect for a lipo battery. When the PicoW transmit via wifi it could have some peak higher than 100ma and on operation it is around 40ma but on light sleep it is around 2ma when you deinit the wifi.

The ADC3 analog pin could read Vsys Voltage via the build-in resistor divider. Then it is possible to read it. My readVsys() function.

My solar solar deliver 5V (at 0ma) and a maximum of 25ma (short). This is way not enough to run the Pico all the time. This is why I'm using he light sleep and wake the Pico to take measurement and send the info. If the battery voltage is too high I just reduce the cycle time and I discharge the battery. The same when the Voltage is going to low by increasing the cycle time.

If your solar cell is powerful enough you have no needs to modify the TP4056 pcb (unless changing the resistor which select the current of charge). If the solar cell Voltage is higher than 5V then you will need a step down regulator.

I hope that it is enough to clarify the power part.


N.B. You can't connect the usb cable if the lipo battery is connected to Vsys. You could add a diode to prevent back current but 0.7v drop will reduce the energy efficiency. ( I just removed the battery when i'm debugging with the usb cable).

Daniel

Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Pico W Micro Python MQTT of data to a RP4B

Post by Rissy » Wed Aug 17, 2022 12:54 pm

jimmo wrote:
Wed Aug 17, 2022 11:51 am
Rissy wrote:
Wed Aug 17, 2022 7:43 am
Is anyone able to help with information about my remaining questions here?
If you're using asyncio, then just create a task that does

Code: Select all

import uasyncio as asyncio

async def heartbeat(led):
  while True:
    await asyncio.sleep_ms(29900)
    led.on()
    await asyncio.sleep_ms(100)
    led.off()
Otherwise you can use a timer. On rp2040 / pico you can use a soft timer.

Code: Select all

import machine

def start_heartbeat(led):
  def on(_):
    led.on()
    tim_off = machine.Timer(-1, mode=machine.Timer.ONE_SHOT, period=100, callback=lambda _: led.off())

  tim_on = machine.Timer(-1, mode=machine.Timer.PERIODIC, period=30000, callback=on)
Ooooh this all looks quite fancy. I wont pretend to understand these two solutions or what they do. I've never heard of asyncio for instance. But i'll take a look at these and try them out. Thanks! :)

Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Pico W Micro Python MQTT of data to a RP4B

Post by Rissy » Wed Aug 17, 2022 12:57 pm

danjperron wrote:
Wed Aug 17, 2022 12:21 pm
I think you'd have to identify the low power bits of the code to me before I'd have any chance of trying that out with my setup.
You could supply Vsys with a voltage bettween 1.8 to 5.5V which is perfect for a lipo battery. When the PicoW transmit via wifi it could have some peak higher than 100ma and on operation it is around 40ma but on light sleep it is around 2ma when you deinit the wifi.

The ADC3 analog pin could read Vsys Voltage via the build-in resistor divider. Then it is possible to read it. My readVsys() function.

My solar solar deliver 5V (at 0ma) and a maximum of 25ma (short). This is way not enough to run the Pico all the time. This is why I'm using he light sleep and wake the Pico to take measurement and send the info. If the battery voltage is too high I just reduce the cycle time and I discharge the battery. The same when the Voltage is going to low by increasing the cycle time.

If your solar cell is powerful enough you have no needs to modify the TP4056 pcb (unless changing the resistor which select the current of charge). If the solar cell Voltage is higher than 5V then you will need a step down regulator.

I hope that it is enough to clarify the power part.


N.B. You can't connect the usb cable if the lipo battery is connected to Vsys. You could add a diode to prevent back current but 0.7v drop will reduce the energy efficiency. ( I just removed the battery when i'm debugging with the usb cable).

Daniel
Oh this sounds quite complicated. Do you think there is a point in shutting down the wifi for the matter of 15 mins only to be "woken back up" again for the next data evaluation?

How would one put the wifi to sleep and wake it back up again in between measurement cycles? :?:

DeaD_EyE
Posts: 19
Joined: Sun Jul 17, 2022 12:57 pm
Contact:

Re: Pico W Micro Python MQTT of data to a RP4B

Post by DeaD_EyE » Wed Aug 17, 2022 1:20 pm

Rissy wrote:
Tue Aug 16, 2022 5:37 pm
It would be nice to be able to look at the Pico W and see a regular "heartbeat" to confirm it's still alive and working, and then do the more lengthy flashing routine I have it doing as it is transmitting data to my Pi.
My overengineered example with Software Timers:

Code: Select all

import time
from machine import Pin, Timer


class Blinka:
    def __init__(self, led: Pin, on_time_ms: int, off_time_ms: int):
        self.led = led
        self.on_time = on_time_ms
        self.off_time = off_time_ms
        self.on_timer = Timer(-1)
        self.off_timer = Timer(-1)

    def start(self) -> None:
        """
        Start heartbeat
        """
        self._on()
    
    def stop(self) -> None:
        """
        Stop heartbeat
        """
        self.on_timer.deinit()
        self.off_timer.deinit()
        self.led.off()
    
    def _on(self, timer: Timer | None = None) -> None:
        """
        This callback switches the LED on and starts the timer for LED off.
        """
        self.led.on()
        self.off_timer.init(mode=Timer.ONE_SHOT, period=self.on_time, callback=self._off)
    
    def _off(self, timer: Timer) -> None:
        """
        This callback switches the LED off and starts the timer for LED on
        """
        self.led.off()
        self.on_timer.init(mode=Timer.ONE_SHOT, period=self.off_time, callback=self._on)


led = Pin(22, Pin.OUT)
heartbeat = Blinka(led, on_time_ms=100, off_time_ms=500)
heartbeat.start()

# 100 * 50ms == 5 seconds
for _ in range(100):
    time.sleep_ms(50)
    print("x" if led() else "_", end="")
print()

print("Stopping heartbeat")
heartbeat.stop()
for _ in range(100):
    time.sleep_ms(50)
    print("x" if led() else "_", end="")
print()
I tend to use classes to put everything into the class which is required for the instance, instead of using closures (function in function) or having everything cluttered on module level. The methods with one leading _ are private methods and should not be called from outside. It's just a convention.

The timer variant has the benefit, that you do not have to use uasyncio to run the task, but if you're already using uasyncio, then the first approach fits better and is easier to read (for humans).

Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Pico W Micro Python MQTT of data to a RP4B

Post by Rissy » Wed Aug 17, 2022 5:54 pm

Rissy wrote:
Wed Aug 17, 2022 12:54 pm
jimmo wrote:
Wed Aug 17, 2022 11:51 am
Rissy wrote:
Wed Aug 17, 2022 7:43 am
Is anyone able to help with information about my remaining questions here?
If you're using asyncio, then just create a task that does

Code: Select all

import uasyncio as asyncio

async def heartbeat(led):
  while True:
    await asyncio.sleep_ms(29900)
    led.on()
    await asyncio.sleep_ms(100)
    led.off()
Otherwise you can use a timer. On rp2040 / pico you can use a soft timer.

Code: Select all

import machine

def start_heartbeat(led):
  def on(_):
    led.on()
    tim_off = machine.Timer(-1, mode=machine.Timer.ONE_SHOT, period=100, callback=lambda _: led.off())

  tim_on = machine.Timer(-1, mode=machine.Timer.PERIODIC, period=30000, callback=on)
Ooooh this all looks quite fancy. I wont pretend to understand these two solutions or what they do. I've never heard of asyncio for instance. But i'll take a look at these and try them out. Thanks! :)
Hello jimmo,

Thanks again for your suggestions on my LED heartbeat.

As suspected, I'm having trouble understanding the necessary coding structure with your code incorportated into mine to make it do this heartbeat for around 15mins or so (I'd like to make this time variable for continued testing of other variations rathe than being stuck to seeing the fruits of my labour only ever 15 mins)

This is what i've put, can you, or someone assist with where I've gone wrong?

Code: Select all

while True: #do stuff here
    led.on()
    time.sleep(0.5)
    
    sensor = sht.measure()
    temperature, humidity = sensor
    
    reading = sensor_temp.read_u16() * conversion_factor 
    picotemp = 27 - (reading - 0.706)/0.001721
    
    #make readings 1 decimal place
    tpm1 = round(temperature,1)
    tpm2 = round(humidity,1)
    tpm3 = round(picotemp,1)
    
    #convert float reading values into bytes ready for MQTT transmission
    tpm4 = f"{tpm1}".encode()
    tpm5 = f"{tpm2}".encode()
    tpm6 = f"{tpm3}".encode()
    
    topic_msg1 = tpm4
    topic_msg2 = tpm5
    topic_msg3 = tpm6
    
    #Message displayed to the screen
    print()
    print('SHT Temperature: {:3.1f}ºC'.format(tpm1))
    print('SHT Humidity: {:3.1f}%'.format(tpm2))
    print('Pico W Temperature: {:3.1f}ºC'.format(tpm3))
    
    #Equivalent transmission of displayed readings above
    #(reverse order to match above order on subscriber receipt)
    client.publish(topic_pub3, topic_msg3)
    client.publish(topic_pub2, topic_msg2)
    client.publish(topic_pub1, topic_msg1)
    
    #led.off()
    
    async def heartbeat(led):
        while True:
            await asyncio.sleep_ms(29900)
            led.on()
            await asyncio.sleep_ms(100)
            led.off()
    
    #time.sleep(10)

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Pico W Micro Python MQTT of data to a RP4B

Post by jimmo » Wed Aug 17, 2022 11:40 pm

Rissy wrote:
Wed Aug 17, 2022 5:54 pm
This is what i've put, can you, or someone assist with where I've gone wrong?
This is the asyncio version -- it will only be useful if the rest of your program is using asyncio.

You should use the timer version. The more elaborate class-based version provided by DeaD_EyE is probably more useful to you -- it's conceputally the same as what I wrote just with the ability to stop it and use it via a nice class-based interface.
DeaD_EyE wrote:
Wed Aug 17, 2022 1:20 pm
My overengineered example with Software Timers:

danjperron
Posts: 51
Joined: Thu Dec 27, 2018 11:38 pm
Location: Québec, Canada

Re: Pico W Micro Python MQTT of data to a RP4B

Post by danjperron » Thu Aug 18, 2022 2:18 am

Oh this sounds quite complicated.
Not at all. Solar Cell -> 5V buck converter. -> TP4056 charger -> lipo -> Pico Vsys.

This is a simple setup with a more power full solar cell.
N.B. there are two protoboards So we have four different power rails , I called them BUS, on each side.
SOLAR.jpg
solar to pico
SOLAR.jpg (72.31 KiB) Viewed 75653 times
Do you think there is a point in shutting down the wifi for the matter of 15 mins only to be "woken back up" again for the next data evaluation?
How would one put the wifi to sleep and wake it back up again in between measurement cycles?
If you look at my script it does exactly that.

Inside the loop

- initialize the wifi
- read the sensors
- send the mqtt data
- close and deinit the wifi
- goto lightsleep for n seconds until next loop.

Rissy
Posts: 116
Joined: Sun Aug 14, 2022 8:15 am

Re: Pico W Micro Python MQTT of data to a RP4B

Post by Rissy » Fri Aug 19, 2022 6:26 am

Morning chaps,

I've been a bit quiet on this project for the past few days because I've been desperately trying to get good success at my Raspberry Pi 4B end of this data transmission and although I shoud probably be asking for help in a Python forum, because the data originated from a Micro python environment, and becasue you guys here have the history of my original code where my variables are coming from, I thought it best to at least try and ask for some help here.

I'm not sure if my issue is on the way i'm transmitting my variables, or my lack of coding knowledge for spearating out the variables at the other end. This seems to be much more difficult for some reason than my experiences with some BME280 sensors hooked up directly to my RP4B which i got up and running really quite quickly.

To give you an understanding of what i'm trying to do:

Variables come in from MQTT.
I convert these individually back to floats.
I display them in a terminal window with some other calculations (dew point, MIN temp MAX temp etc) based on the MQTT variables.
At the same time as displaying them on screen, I write them to a .csv file for storage and analysis at my leisure.

Not too difficult eh. I'm doing this just fine with other scripts i'm running in my RP4B with two serial linked (I2C) BME280 temp/hum/press sensors already.

As a reminder, this is my Micor Python code sitting on my Pico W:

Code: Select all

#Necessary library imports for this code to function
from secrets import SSID
from secrets import PASSWORD
from secrets import IP
from secrets import IP_mask
from secrets import IP_gateway
from secrets import IP_DNS
from secrets import MQTTSERVE
from umqtt.simple import MQTTClient
#import time
import network
import ubinascii
import socket
from machine import SoftI2C, Pin
import sht30
import uasyncio as asyncio

#Define the interface of the SHT30 Temp/Humidity sensor with the Pico W
i2c=SoftI2C(sda=Pin(4), scl=Pin(5))
sht=sht30.SHT30(i2c=i2c, i2c_address=68)
sensor = sht.measure()
temperature, humidity = sensor

#Define the onboard Pico Temperature sensor and necessary conversion factor
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)
 
#Active the onboard Pico W Wi-Fi and connect to home network defined through "secrets.py"
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
#print(wlan.scan())
wlan.connect(SSID, PASSWORD)

#Configure this Pico W for a static IP address on router using the following
UseStaticIP = True
IP = IP
IP_mask = IP_mask
IP_gateway = IP_gateway
IP_DNS = IP_DNS

#Read the MAC address from the Pico W itself
mac = ubinascii.hexlify(network.WLAN().config('mac'),':').decode()
print("MAC address for this Pico W:", mac)
# Wait for connect or fail
max_wait = 10
while max_wait > 0:
 if wlan.status() < 0 or wlan.status() >= 3:
  break
  max_wait -= 1
  print('waiting for connection...')
  time.sleep(1)

# Handle connection error
if wlan.status() != 3:
 raise RuntimeError('network connection attempt failed')
else:
 print("Pico W Wi-Fi is connected to: ",SSID)
 status = wlan.ifconfig()
 print( "ip address for this Pico W: " + status[0] )
 print()
 print("Channel: ", wlan.config('channel'))
 print("SSID: ", wlan.config('essid'))
 print("TXPOWER: ", wlan.config('txpower'))

wlan.config(pm = 0xa11140)

#Show some onboard LED flashing to show that attempting to connect to the Wi-Fi has been completed
time.sleep(5)
led = machine.Pin("LED", machine.Pin.OUT)
#led = Pin(15, Pin.OUT)
led.off()
time.sleep(2)
led.toggle()
time.sleep(0.2)
led.toggle()
time.sleep(1)
led.toggle()
time.sleep(0.2)
led.toggle()
time.sleep(1)
led.toggle()
time.sleep(0.2)
led.toggle()
time.sleep(1)
led.toggle()
time.sleep(2)

#Setup MQTT server, local client ID (not really required),
#and published data transmissions hierarchy
mqtt_server = MQTTSERVE
client_id = b'PICOW'
topic_pub1 = b'PicoW/OS_Temp'
topic_pub2 = b'PicoW/OS_Hum'
topic_pub3 = b'PicoW/Pico_Temp'

#For the above topics, use "PicoW/+"
#at the subscriber side to receive all
#three messages at once or use the full
#titles individually i.e PicoW/OS_Temp for
#just the outside temperature variable

def mqtt_connect():
    client = MQTTClient(client_id, mqtt_server, keepalive=3600)
    client.connect()
    print('Connected to %s MQTT Broker'%(mqtt_server))
    return client

def reconnect():
    print('Failed to connect to the MQTT Broker. Reconnecting...')
    time.sleep(5)
    machine.reset()

try:
    client = mqtt_connect()
except OSError as e:
    reconnect()
    
#The main script of repeativeness for reading in from the connected sensor
#and taking in onboard temperature readings
while True: #do stuff here
#    async def heartbeat(led):
#        await asyncio.sleep_ms(29900)
#        led.on()
#        await asyncio.sleep_ms(100)
#        led.off()

    led.on()
    time.sleep(0.5)
    
    sensor = sht.measure()
    temperature, humidity = sensor
    
    reading = sensor_temp.read_u16() * conversion_factor 
    picotemp = 27 - (reading - 0.706)/0.001721
    
    #make readings 1 decimal place
    tpm1 = round(temperature,1)
    tpm2 = round(humidity,1)
    tpm3 = round(picotemp,1)
    
    #convert float reading values into bytes ready for MQTT transmission
    tpm4 = f"{tpm1}".encode()
    tpm5 = f"{tpm2}".encode()
    tpm6 = f"{tpm3}".encode()
    
    topic_msg1 = tpm4
    topic_msg2 = tpm5
    topic_msg3 = tpm6
    
    #Message displayed to the screen
    print()
    print('SHT Temperature: {:3.1f}ºC'.format(tpm1))
    print('SHT Humidity: {:3.1f}%'.format(tpm2))
    print('Pico W Temperature: {:3.1f}ºC'.format(tpm3))
    
    #Equivalent transmission of displayed readings above
    #(reverse order to match above order on subscriber receipt)
    client.publish(topic_pub3, topic_msg3)
    client.publish(topic_pub2, topic_msg2)
    client.publish(topic_pub1, topic_msg1)
    
    led.off()
  
    time.sleep(10)
And although I was trying to insert the necessary MQTT publishing code into another similar script to that which I already have working for the BME280's, I'm having that much difficulty with it that I've resorted to just going to the absolute basics, which I still cant make work properly.

This is my RP4B code (or at least the latest incarnation of it):

Code: Select all

#!/usr/bin/env python
#!/bin/bash
#MQTT.py

#Required Imports
import time
import datetime
import sys
import os
import paho.mqtt.client as mqtt

broker = '192.168.0.51'
port = 1883
mqttclient = "PiLogger"
client = mqtt.Client(mqttclient)
topic1 = "PicoW/OS_Temp"
topic2 = "PicoW/OS_Hum"
topic3 = "PicoW/Pico_Temp"

def on_connect(client, userdata, flags, rc):
    # This will be called once the client connects
    #print(f"Connected with result code {rc}")
    # Subscribe here!

    client.subscribe(topic1)
    client.subscribe(topic2)
    client.subscribe(topic3)
    
def message1(client, userdata, topic1):
    #print(f"Message received for Topic: [{topic1.topic1}]: {topic1.payload}")
    str1 = str.format(topic1.payload)
    float1 = float('str1')
    #print("OS_Temp: ", OS_Temp)
    #print(OS_Temp)
    #print()
        
def message2(client, userdata, topic2):
#    print(f"Message received for Topic: [{msg2.topic2}]: {msg2.payload}")
    str2 = str.format(topic2.payload)
    float2 = float('str2')
    #print("OS_Hum: ", OS_Hum)
    #print(OS_Hum)
    #print()
    
def message3(client, userdata, topic3):
#    print(f"Message received for Topic: [{msg3.topic3}]: {msg3.payload}")
    str3 = str.format(topic3.payload)
    float3 = float('str3')
    #print("Pico_Temp: ", Pico_Temp)
    #print(Pico_Temp)
    #print()

client = mqtt.Client(mqttclient)
client.on_connect = on_connect
#time.sleep(1)
client.on_message = message1
#str1 = message1
#OS_Temp = float('str1')
OS_Temp = message1
client.on_message = message2
#str2 = message2
#OS_Hum = float('str2')
OS_Hum = message2
client.on_message = message3
#str3 = message3
#Pico_Temp = float('str3')
Pico_Temp = message3

print("OS_Temp: ", OS_Temp)
print("OS_Hum: ", OS_Hum)
print("Pico_Temp: ", Pico_Temp)
print()
time.sleep(2)
client.connect(broker, port)
client.loop_forever()
What this is producing is the follwing:

Code: Select all

OS_Temp:  <function message1 at 0xb4517418>
OS_Hum:  <function message2 at 0xb4517460>
Pico_Temp:  <function message3 at 0xb45174a8>

Traceback (most recent call last):
  File "/home/rissypi/BME280_Envir_Sen/MQTT.py", line 76, in <module>
    client.loop_forever()
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
    self._handle_on_message(message)
  File "/home/rissypi/.local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/home/rissypi/BME280_Envir_Sen/MQTT.py", line 47, in message3
    str3 = str.format(topic3.payload)
TypeError: descriptor 'format' for 'str' objects doesn't apply to a 'bytes' object
The best edit of this code i've had so far was getting all three vartiables being displayed to the screen and these appeared looking like decimal numbers, but could still have been strings, i'm uncertain (how can you tell?) but then adding the individual titles to them seems to be a massive headache for some reason. Despite all having separate and indepedent names, they would all get called "Pico_Temp" (I presume because this was the last title in the code, even though only the last variable is associated with that title!?)

Are all three of these values being joined together as a tuple or something, even though i seemingly have written them independently at the Pico W? I'm not clear on how to deal with tuples, but haven't seen the need to use them so far.

I'm needing help.

I need to know how to title them and display to a terminal window independly of one another.
I need to know where in the code (around about the MQTT code) I can comfortably put my other lines of code for terminal messages and writing to files etc without screwing up the MQTT read in business.

Feel free to guide me with written examples of edits of my code submitted here (either at Pico W or RP4B ends)

Please. I'm pulling my hair out over this now! It shouldn't be this difficult! :!: :!: :?:

Post Reply