408-754-4176 | info@reachtech.com

by Reach Technology
Support > Frequently Asked Questions > I use connection.sendMessage() to send messages to my microcontroller, but get a “Reference Error” when I run the QML application on a PC. How do I avoid this error?

I use connection.sendMessage() to send messages to my microcontroller, but get a “Reference Error” when I run the QML application on a PC. How do I avoid this error?

You can test for the presence of “connection” with this approach:

The code above will use connection.sendMessage() when running on the display module, but will use console.log() when running on the PC.