MakerGram Logo

    MakerGram

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups

    Help needed: Arduino Wireless Notice Board project

    Arduino
    6
    28
    3656
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • salmanfaris
      salmanfaris last edited by

      @SAFVAN are you getting any error or something ?

      rafitc99 1 Reply Last reply Reply Quote 0
      • rafitc99
        rafitc99 @salmanfaris last edited by

        @salmanfaris no any error, issue is in that LED metrix library print function parameters are *const char. So need to convert SMS boast string to const char *Variable.

        salmanfaris 1 Reply Last reply Reply Quote 1
        • S
          SAFVAN @SAFVAN last edited by

          @kowshik1729 display is 16×32 P10 LED display.
          RX and TX connected pin 3&2.
          P10 connected as https://circuitdigest.com/microcontroller-projects/digital-notice-board-using-p10-led-matrix-display-and-arduino

          1 Reply Last reply Reply Quote 0
          • salmanfaris
            salmanfaris @rafitc99 last edited by salmanfaris

            Hi @rafitc99, You can convert the string to char array using toCharArray() it will Copies the String’s characters to the supplied buffer.

            • Syntax
            myString.toCharArray(buf, len)
            
            • Parameters
              myString: a variable of type String.
              buf: the buffer to copy the characters into. Allowed data types: array of char.
              len: the size of the buffer. Allowed data types: unsigned int.

            more : https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/tochararray/ , https://www.arduino.cc/en/Tutorial/BuiltInExamples#strings

            also @SAFVAN is using const char* to hold message array You cannot change the contents of the location(s) this pointer points to.

            rafitc99 1 Reply Last reply Reply Quote 0
            • rafitc99
              rafitc99 @salmanfaris last edited by

              @salmanfaris Rewrite all code and uploaded. But SMS is not displaying correctly in LED Board, .. I'm attaching code and display output. take a look ,

              #include <SoftwareSerial.h>
              #include <SPI.h>
              #include <DMD.h>
              #include <TimerOne.h>
              #include "SystemFont5x7.h"
              #include "Arial_black_16.h"
              
              #define ROW 1
              #define COLUMN 1
              #define FONT Arial_Black_16
              
              DMD led_module(ROW, COLUMN);
              
              String st; 
              const char *msg;
              unsigned int LengMsg;
              SoftwareSerial mySerial(3, 2);
              
              void scan_module(){
                led_module.scanDisplayBySPI();
              }
              
              void setup() {
                Timer1.initialize(2000);
                Timer1.attachInterrupt(scan_module);
                led_module.clearScreen( true );
                
                Serial.begin(4800);
                mySerial.begin(4800);
                Serial.println("Starting..."); 
                delay(1000);
                mySerial.println("AT");
                pollSms();
                mySerial.println("AT+CMGF=1"); 
                pollSms();
                mySerial.println("AT+CNMI=1,2,0,0,0");
                pollSms();
              }
              
              void loop(){
                pollSms();
                delay(500);
              
                //Start print in led matrix 
                led_module.selectFont(FONT);
                led_module.drawMarquee(msg,LengMsg, (32 * ROW), 0);
                long start = millis();
                long timming = start;
                boolean flag = false;
                while (!flag){
                  if((timming + 20) < millis()){
                      flag = led_module.stepMarquee(-1, 0);
                      timming = millis();
                    }
                  }
                }
              
              void pollSms(){
                delay(500);
                while (Serial.available()) {
                  mySerial.write(Serial.read());
                  //String st = String(Serial.read());
                  //Serial.println(st);
                }
                while(mySerial.available()) {
                  Serial.write(mySerial.read());
                  st = String(mySerial.readString());
                  Serial.println(st);
                  LengMsg = st.length();
                  st.toCharArray(msg,LengMsg);    
                }
                delay(500);
              }
              

              output video : video link

              A 1 Reply Last reply Reply Quote 0
              • salmanfaris
                salmanfaris last edited by

                Can you print the SMS on the serial monitor too? so we can conclude the problem

                rafitc99 1 Reply Last reply Reply Quote 0
                • rafitc99
                  rafitc99 @salmanfaris last edited by

                  @salmanfaris in serial monitor getting normal text. No problem in there.

                  salmanfaris 1 Reply Last reply Reply Quote 0
                  • salmanfaris
                    salmanfaris @rafitc99 last edited by

                    @rafitc99 Okay, it might be sending char from SMS buffer to LED panel. let me check, I'll get back to you.

                    1 Reply Last reply Reply Quote 0
                    • A
                      arunksoman @rafitc99 last edited by

                      @rafitc99 Please answer my question...

                      1. Why did u declared message as const? Const indicates you are not going to change that variable any more.

                      Try to use c_str() instead to_charArray()

                      Reference

                      1 Reply Last reply Reply Quote 0
                      • salmanfaris
                        salmanfaris last edited by

                        @rafitc99 , @SAFVAN did you tried the @arunksoman suggestion?

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post

                        Recent Posts

                        • @codelery Awesome. That's great news. Kudos to @rafitc99 . 🙌

                          @codelery Please keep us updated about your project, looking forward to seeing it in action 🤩

                          • read more
                        • C

                          @rafitc99 I changed the buffer and that solved the problem. Thanks a lot for coming to my rescue.

                          • read more
                        • C

                          @salmanfaris I did change the buffer size and everything is working perfectly. Thanks coming to my rescue.

                          • read more
                        • @codelery said in Help needed: Arduino Wireless Notice Board project:

                          I am using the hardware serial (pin 0 and 1 on Arduino Uno)

                          As @rafitc99 mentioned, you need to expand the Serila buffer, in the hardware serial also the Arduino board package implements a 64-byte ring buffer for send and receive on the hardware serial messages. So you need to change that to 256 as per your message length.

                          • read more
                        • C

                          @rafitc99 The thing is that I am not using the SoftwareSerial library in receiving the message from the first microcontroller. I am using the hardware serial (pin 0 and 1 on Arduino Uno)

                          • read more
                        By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
                        Copyright © 2023 MakerGram, All rights reserved.
                        Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct