BS2 to Nextion HMI display
Since I've been playing with Nextion HMI displays lately, I was watching JonnyMac's Holiday Lighting Display videos. I notice that Ken asked if the Nextion could be used with a Basic Stamp. That made me wonder.
I don't have a BS1, but I have some BS2s to test with, so I did. I modified a Nextion project that I created as a demo for my spin & spin2 libraries and created some crude BS2 code to make it work. Surprisingly, I was able to get all of the same functionality as my Propeller version. It is a lot slower and less responsive, but it works.
The BS2 code assumes a Nextion (or serial to USB converter to the Nextion simulator) connected to pins 1&2 as it will also be sending data to the debug terminal.
Most of the work of this demo is performed in the BS2 to demonstrate that it is possible. It would be more efficient for an application to let the Nextion handle more of the state tracking and let the BS2 handle hardware I/O functions.
The Nextion demo project has 2 pages.
The first page has 2 buttons, 1 number, 1 float and 1 text field
The Run button is dual state and when depressed it will cause
the BS2 To change the text field and increment the number and
float fields.
The Page1 button will cause the BS2 to request a change to page1
The second page has 1 button, 1 slider, 1 gauge, 1 progress and 1 waveform
The slider is located on the far right of the page
Moving the slider will cause the BS2 to retrieve its position
and use that value to update the progress bar, gauge and waveform.
The Page0 button will cause the BS2 to request a change to page0
It's totally useless, but it was fun to play with the BS2 again.