B4R Question Lib Objects and multi-instances

Cableguy

Expert
Licensed User
Longtime User
Hi EREL,

Am I correct in assuming that some objects should NOT have multi-instances?
I'm referring specially to objects like sensor libs, lcd, etc (neoPixel included)

I tried to use to different objects, one in main, the other in a code module, to control the same hardware (my neoPixel board), so the object name was different, but the initialization was the same, meaning, same pin, etc...
In my experiences, I found that timer based animations got mixed, even thou only one of the timers was running...
So, it is either a lib thing, that doesn't like to be handled by more than one object, or a timer thing...
since B4R is somewhat peculiar in its functioning, can it be that two timers named "TIMER1" cannot coexist even if declared and used in different code modules??
 

Cableguy

Expert
Licensed User
Longtime User
OK, so my best approach will be to create a code module to interact with the hardware and have it called from whichever other module I want.
 
Upvote 0

Hypnos

Active Member
Licensed User
Longtime User
Hi Erel,

How about the MQTT lib ? for some reason my project need to connect to more than 1 MQTT provider with different user name (cloudmqtt.com), but I got some strange issue.

I have two MQTT_MessageArrived Sub:

e.g.

MQTT_A_MessageArrived (Topic as String, Payload() as Byte)

MQTT_B_MessageArrived (Topic as String, Payload() as Byte)


I can receive the message from both account but all the message will go to MQTT_B_MessageArrived.. Is that mean the MQTT lib not allow for multiple instance ? Thanks!
 
Upvote 0
Top