Modifications

Sauter à la navigation Sauter à la recherche
644 octets ajoutés ,  29 octobre 2018 à 21:54
Ligne 81 : Ligne 81 :     
We propose the following format:
 
We propose the following format:
  <nowiki>:data1|data2|data3|data4;/r/n
+
  <nowiki>:data1|data2|data3|data4;/r/n</nowiki>
    
where:
 
where:
* : is the begin of data stream
+
* ''':''' is the begin of data stream
* ; is the end of data stream
+
* ''';''' is the end of data stream
* /r/n are optional a carriage return + line feed. This will would make the messages user friendly when the the messages are viewed in a console or terminal.
+
* '''/r/n''' are optional carriage return + line feed characters.<br />This will would make the messages user friendly when the the messages are viewed in a console or terminal.
* | is the separator between data items.
+
* '''|''' is the separator between data items.
* datax are the string representation of data. The characters ;:| are forbidden in this area.
+
* '''datax''' are the string representation of the various data. The characters ;:| are forbidden in this area.
</nowiki>
+
 
 
+
we would also recommend to use:
 +
* '''packetnum''' as data1. packetnum is a simple variable increment of one unit after each transmission. This would allow the receiver to detect lost message (since it would exist holes in the numbering of received messages).
 +
* '''timing_info''' as data2. This would help to create timing chart or time base data analysis. We suggest to use the Arduino's {{fname|millis()}} function which count the number of milliseconds since the last microcontroler reset.
 +
 
 +
As explained later in the code the {{fname|packet_str}} variable contains the message to be transmitted to the ground.
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
    String packet_str = String( ":"+String(packetnum,DEC)+"|" );
+
String packet_str = String( ":"+String(packetnum,DEC)+"|" );
    packet_str.concat( String( ms,DEC)+"|" );
+
packet_str.concat( String( ms,DEC)+"|" );
    packet_str.concat( String( temperature, 2 )+"|" );
+
packet_str.concat( String( temperature, 2 )+"|" );
    packet_str.concat( String( bme_hpa, 2 )+"|" );
+
packet_str.concat( String( bme_hpa, 2 )+"|" );
    packet_str.concat( String( bme_temp, 2 )+";\r\n" );
+
packet_str.concat( String( bme_temp, 2 )+";\r\n" );
 
</syntaxhighlight>
 
</syntaxhighlight>
  
29 910

modifications

Menu de navigation