Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ATX2.h>
- void setup()
- {
- XIOinit();
- glcdClear();
- glcdMode(1);
- setTextSize(2);
- setTextColor(GLCD_SKY);
- glcd(1, 0, "Connect ");
- setTextColor(GLCD_GREEN);
- glcd(2, 0, "Wireless-X");
- glcd(3, 0, " Receiver ");
- setTextColor(GLCD_WHITE);
- glcd(4, 0, "to (2) RxD1 ");
- setTextColor(GLCD_ORANGE);
- glcd(5, 0, "and push (OK)");
- while (!sw_OK());
- glcdClear();
- setTextSize(2);
- Serial1.begin(9600);
- }
- void loop()
- {
- int RxByte;
- while (1)
- {
- RxByte = 0;
- while (Serial1.available() > 0)
- RxByte = Serial1.read();
- setTextColor(GLCD_WHITE);
- glcd(1, 2, "%b", ((RxByte & 0x80) != 0));
- glcd(2, 0, "%b", ((RxByte & 0x40) != 0));
- glcd(2, 4, "%b", ((RxByte & 0x20) != 0));
- glcd(3, 2, "%b", ((RxByte & 0x10) != 0));
- glcd(1, 10, "%b", ((RxByte & 0x08) != 0));
- glcd(2, 8, "%b", ((RxByte & 0x04) != 0));
- glcd(2, 12, "%b", ((RxByte & 0x02) != 0));
- glcd(3, 10, "%b", ((RxByte & 0x01) != 0));
- setTextColor(GLCD_YELLOW);
- glcd(5, 0, "DATA:%b%b%b%b%b%b%b%b",
- ((RxByte & 0x80) != 0), ((RxByte & 0x40) != 0),
- ((RxByte & 0x20) != 0), ((RxByte & 0x10) != 0),
- ((RxByte & 0x08) != 0), ((RxByte & 0x04) != 0),
- ((RxByte & 0x02) != 0), ((RxByte & 0x01) != 0)
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement