Modifications

Sauter à la navigation Sauter à la recherche
Ligne 178 : Ligne 178 :  
we would also recommend to use:
 
we would also recommend to use:
 
* '''counter''' 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).
 
* '''counter''' 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.  
+
* '''time_sec''' as data2. This would help to create timing chart or time based data analysis. We suggest to use the {{fname|time.time()}} function which count the number of seconds 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. The Arduino's {{fname|String}} class would ease the transformation of data to their string representation.  
+
As explained later in the code the {{fname|msg}} variable contains the message to be transmitted to the ground. The python language offers facilities to format string and transform typed data to their string representation.  
<syntaxhighlight lang="c">
+
<syntaxhighlight lang="python">
String packet_str = String( ":"+String(packetnum,DEC)+"|" );
+
msg = ":%i,%i,%6.2f,%5.2f,%5.2f;" % (counter,time.time()-ctime,hpa,temp,t)
packet_str.concat( String( ms,DEC)+"|" );
+
print( msg )
packet_str.concat( String( temperature, 2 )+"|" );
+
# Send over RFM69HCW module
packet_str.concat( String( bme_hpa, 2 )+"|" );
+
rfm.send( bytes(msg , "utf-8") )
packet_str.concat( String( bme_temp, 2 )+";\r\n" );
   
</syntaxhighlight>
 
</syntaxhighlight>
    
{{ENG-CANSAT-PICO-TRAILER}}
 
{{ENG-CANSAT-PICO-TRAILER}}
29 917

modifications

Menu de navigation