B4R Question No Log is coming at serial monitor

Discussion in 'B4R Questions' started by pokhraj_d, Oct 27, 2018.

  1. pokhraj_d

    pokhraj_d Member

    I am running the gps code with Tiny_GPS library. No error has been found during compilation.
    But no result is also showing at log window.
    Where is my mistake? Please suggest.

    Below is my code:
    #Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
    #End Region

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
        'Public variables can be accessed from all modules.
        Public Serial1 As Serial
    Public serial2 As SoftwareSerial   'Additional software serial port
        Private astream As AsyncStreams
    Private lat,lon As Long
    End Sub

    Private Sub AppStart
    9600,5,6', rx 5, TX is 6
    End Sub

    Sub astream_newdata(Buffer() As Byte)
    End Sub

    #if C
    #include "TinyGPS.h"
    #define PIN_TX 6
    #define PIN_RX 5
    SoftwareSerial serial2(PIN_TX,PIN_RX);
    TinyGPS gps;
    void setup(B4R::Object* o){
    void gpsread (B4R::Object* o) {
        int c = serial2.read();
       long slat, slong;
       b4r_main::_lat = slat;
       b4r_main::_lon = slong;
    #End if
    Pokhraj Das
  2. Erel

    Erel Administrator Staff Member Licensed User

    I wouldn't use this library at all. It shouldn't be too difficult to parse the NMEA strings yourself.

    Your code creates two SoftwareSerials on the same pins. You must remove one of them.
  3. pokhraj_d

    pokhraj_d Member

    Hello @Erel

    Not sure about how to remove the pin related to Serial1.
    I have commented out the code related to Serial1, but still no output coming.
    Could you please advice once please.

  4. Erel

    Erel Administrator Staff Member Licensed User

    I was talking about the two 'serial2' objects.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice