I have GPS, SONAR and two BLDC motors connected. I have to send data to my PC. I have radio-link. How can I send this data?

ericgibbs

Joined Jan 29, 2010
13,277
hi umer,
Downloaded your file. will check, I do not have an OLED.

Look at this option,no buttons, no OLED, needs a little tidy up, it works.
To use:
The Serial0 port input: Tyyyy,mm,dd,hh,mm,ss , will set the RTC and give a Set Time reply
E

C-like:
/// Serial0
    if (stringComplete0){
      strID0=(dataString0.substring(0,1));
//Serial.println("Ser0");      
       if (strID0 == "$"){      
      Serial.print(dataString0);
    File dataFile = SD.open("datalog.txt", FILE_WRITE);
      // if the file is available, write to it:
      if (dataFile) {
        dataFile.print(dt);
        dataFile.print(" ");
        dataFile.print(tm);
        dataFile.print(msec);
        dataFile.print(",");
        dataFile.print(dataString1);
        dataFile.close();  
      } else {
        Serial.println("error opening datalog.txt");
      } }    
        // clear the string:

  // Expected DateTime String=  T2011,06,18,08,52,30
  //
if (strID0 == "T"){
          String strYear=(dataString0.substring(1,5));
          int myYear = strYear.toInt();          
          String strMonth=(dataString0.substring(6,8));
          int myMonth = strMonth.toInt();      
          String strDay=(dataString0.substring(9,11));
          int myDay = strDay.toInt();        
          String strHour=(dataString0.substring(12,14));      
          int myHour = strHour.toInt();                    
          String strMin=(dataString0.substring(15,17));
          int myMin = strMin.toInt();                  
          String strSec=(dataString0.substring(18,20));
          int mySec = strSec.toInt();
                               
      rtc.adjust(DateTime(myYear,myMonth,myDay,myHour,myMin,mySec));  
        strID0="";            
        }
//Date Time Check  
  DateTime now = rtc.now();
  Serial.print  (now.year());
  Serial.print  (now.month());
  Serial.println (now.day());      
  Serial.print  (now.hour());
  Serial.print  (now.minute());
  Serial.println (now.second());

        dataString0 = "";
        stringComplete0 = false;
        strID0="";
    }
 

ericgibbs

Joined Jan 29, 2010
13,277
Sorry for my mistake. The last code I have sent you is working.
hi umer,
OK, but do you plan to actually use my Code in your project, it was written for a DS1307.... your last posted Code was for a DS3231.???

E


Update:
Who wrote that Code for the DS3231.??
 
Last edited:

ericgibbs

Joined Jan 29, 2010
13,277
hi.
Look at this, it is all you need for selecting 4 possible Baud rates. mounted on your main PCB.
Uses 2 pins of the MCU
E

00 = 4800 Baud
01 = 9600
10 = 19200
11 = 115200



ESP_ 468 Jun. 18 10.21.png
 

ericgibbs

Joined Jan 29, 2010
13,277
It maybe modern, but if you are selling this product, it adds to the cost of the unit and also its another piece of kit, which if lost or fails, would make it impossible to set the Baud Rate or the Time...
 

Thread Starter

umerrai1

Joined Mar 29, 2021
233
Sir, I am getting reading on analog pin of arduino from 0 to 1023. What type of value is this? Is it ASCII characters or digital?
 

Thread Starter

umerrai1

Joined Mar 29, 2021
233
I have a bldc motors. it is working in both directions. but I need to start this motor slowly to increase its velocity not suddenly.
 

Thread Starter

umerrai1

Joined Mar 29, 2021
233
I wrote it. I know it is working. But motors starts at full speed. I want that motor increases it's speed slowly slowly.
 
Top