Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SPI.h"
- #include "NRFLite.h"
- #include <LiquidCrystal.h>
- const int rs = 5, en = 6, d4 = 4, d5 = 3, d6 = 2, d7 = 7;
- LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
- const static uint8_t RADIO_ID = 0; // Our radio's id. The transmitter will send to this id.
- const static uint8_t PIN_RADIO_CE = 9;
- const static uint8_t PIN_RADIO_CSN = 10;
- NRFLite _radio;
- char _hello[30];
- int newsize;
- char n[30];
- char m[30];
- void setup() {
- lcd.begin(8, 2);
- Serial.begin(115200);
- if (!_radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN)) {
- Serial.println("Cannot communicate with radio");
- while (1)
- ; // Wait here forever.
- }
- }
- void loop() {
- while (_radio.hasData()) {
- _radio.readData(&_hello);
- Serial.println(_hello);
- int newsize = strlen(_hello) - 1;
- Serial.println(newsize);
- if (newsize <= 30) {
- Serial.println(" 0th row and 0th column");
- for (int k = 0; k <= 7; k++) {
- lcd.setCursor(0, 0);
- n[k] = _hello[k];
- delay(200);
- lcd.print(n);
- //Serial.print(n);
- }
- if (newsize > 8) {
- Serial.println(" 0th row and 1st column \n");
- for (int t = 8; t <= 15; t++) {
- lcd.setCursor(0, 1);
- n[t] = _hello[t];
- delay(200);
- lcd.print(n);
- //Serial.print(n);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment