Recent blog entries

SurfPad: Bluetooth Connectivity 2/4 -Arduino as Remote App

In the previous article, issues with and how to connect a Windows 10 system to an Arduino device using the Classic (Generic) Bluetooth Serial (SPP) connectivity was covered in detail. This is so that a UWP app running on a Windows 10 device can act as the UI for an app running on a remote device such as an Arduino or IOT-Core device. The UI a dynamically generated array of buttons with multiline text that when pressed send a code representing the button to the remote app for interpretation. There is also a list box in the UI that can be used to display messages from the remote app. The UI specified in Json is passed via the serial medium from the remote app to the Windows system and used to generate the app’s UI dynamically in XAMl at runtime. This article covers the code to receive the json text from the remote device and how to interpret it within the UWP app as well as how to pass the button code and get the remote app’s text messages.

Links

The Arduino Remote App

Whilst this app was initially developed using the Arduino IDE, the decision was made to install the Arduino addin available for Visual Studio 2017 which besides supporting debugging, also enables its Sketch to be included the SufPad project and thus to be maintained in the GitHub repository., I tried to use a much earlier version of this plugin without success. I did though find that the current version works well.

On the Arduino Toolbar select the Arduino board and the USB COM port that the Arduino device is connect to the desktop via.

To test build press on the toolbar

To build, download and run the app press on the toolbar

When you first run a sketch you get an option to trial or subscribe.

When the Sketch is running press to disconnect. But of course the sketch will continue to run on the device.

These buttons are located on the left of the toolbar:

Note that a Serial Terminal appears as normal used for Arduino Serial.print() commands

As per normal VS debugging you can set Breakpoints, traces etc for debugging.

You can have breakpoints

You can have conditional breakpoints

You can disable breakpoints

You can set the action at a breakpoint - Log a message to the Output Window

- Continue execution immediately, or not

Logging a message is useful as if you stop at the breakpoint the current message (eg a loop counter) shows in the Expression window.These messages also get written to the Output-Debug window so if continued execution is chosen you see a trace in that window.

To display an expression/variable/property value you encase it in braces in the Log Message string eg Loop No: {i}