Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
- Committer:
- dfraj
- Date:
- 2022-01-21
- Revision:
- 1:53649f3053fc
- Parent:
- 0:66e658666f89
- Child:
- 2:d4209a7955c3
File content as of revision 1:53649f3053fc:
#include "mbed.h" Serial nextion(p28, p27); DigitalOut myled1(LED2); DigitalOut myled2(LED4); char buffer[20]; int znak = 0; void Rx_interrupt(void){ char c; if(nextion.readable()) { c = nextion.getc(); buffer[znak] = c; znak++; if ((znak >= 3) && (buffer[znak-1] == 0xff) && (buffer[znak-2] == 0xff) && (buffer[znak-3] == 0xff)) { if (buffer[2] == 0x04){ myled1 = buffer[3]; }else if (buffer[0] == 0x5A){ myled2 = buffer[1] - 48; } memset(buffer,0,strlen(buffer)); znak = 0; } } } int main(){ nextion.attach(&Rx_interrupt, Serial::RxIrq); while (1) { } }