コード例 #1
0
ファイル: rtty.c プロジェクト: joelrebel/hab001
void rtty_send_pressure(long p)
{
	int temp;
	char buf[5];
	float t;

	t=p/100.0; /* to hPa */

	/* negative? */
	if (p<0)
		rtty_txbyte('-');

	/* integer part */	
	temp = (int)t;

	itoa(temp, buf, 10);
	rtty_txstring(buf);
	rtty_txbyte('.');

	/* decimal part */
	temp = (t - temp) * 100;
	itoa(temp, buf, 10);
	rtty_txstring(buf);

	rtty_txstring(" hPa");

}
コード例 #2
0
ファイル: rtty.c プロジェクト: joelrebel/hab001
void rtty_send_temperature(float t)
{
	int temp;
	char buf[4];

	/* negative? */
	if (t<0)
		rtty_txbyte('-');

	/* integer part */	
	temp = (int)t;

	itoa(temp, buf, 10);
	rtty_txstring(buf);
	rtty_txbyte('.');

	/* decimal part */
	temp = (t - temp) * 100;
	itoa(temp, buf, 10);
	rtty_txstring(buf);

	rtty_txstring(" C");
}
コード例 #3
0
ファイル: main.cpp プロジェクト: rmhsilva/vertigo
int main() {
	led = 1;
	//int response = rfm434.write(0xFF);
	initSPI_434();

	init_rfm434();
	
	write_rfm434(0x71, 0x00); // unmodulated carrier
	//This sets up the GPIOs to automatically switch the antenna depending on Tx or Rx state, only needs to be done at start up
	write_rfm434(0x0b,0x12);
	write_rfm434(0x0c,0x15);
  
	setFrequency_rfm434(434.201);
  
	write_rfm434(0x6D, 0x04);// turn tx low power 11db
  
	write_rfm434(0x07, 0x08); // turn tx on
	
	wait(5.0);
	
	rtty_txstring("TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST");
}
コード例 #4
0
void loop() {
  LED_Status(LED_GREEN,0);
  if (Serial.available()) {
	readCommand();
	// "command" now contains the full command
      commandClean[0]='\0';
      int i = 0;
      int j = 0;
      while (command[i] != '\n' && i<128 && j<60){
        if (command[i] != char(32)){
          commandClean[j] = command[i];
          j++;
        }
        i++;
      }
      commandClean[j] = '\n';
   
      // Send to transmitter     
      LED_Status(LED_GREEN,0);
      unsigned int CHECKSUM = gps_CRC16_checksum(commandClean);  // Calculates the checksum for this datastring
      char checksum_str[6];
      sprintf(checksum_str, "*%04X\n", CHECKSUM);
      strcat(commandClean,checksum_str); 
	  Serial.println(commandClean);
      rtty_txstring (commandClean);  
      LED_Status(LED_OFF,0);

	  // Send to Mobile Phone
      unsigned long m = millis(); 
      if ((m - gblSMSElapsed) > WAIT_SMS) {
		if (glb_phone_trans == LOW){
			// Send to mobile phone
			mobPhone.println(PHONE_AT);          // wakes up phone
			LED_Status(LED_GREEN,250);
			LED_Status(LED_OFF,250);
			mobPhone.println(PHONE_DELETE_SMS);  // deletes message at index of 1
			LED_Status(LED_GREEN,250);
			LED_Status(LED_OFF,250);
			mobPhone.println(PHONE_SET_SMS_TXT_MODE_COMMAND); // Puts phone into SMS mode
			LED_Status(LED_GREEN,250);
			LED_Status(LED_OFF,500);    
			mobPhone.println(PHONE_SMS_NUMBER); // My number
			LED_Status(LED_GREEN,250);
			LED_Status(LED_OFF,500);    
			mobPhone.print(commandClean);         //data
			mobPhone.write(byte(26));             // (signals end of message)
			LED_Status(LED_GREEN,250);
			LED_Status(LED_OFF,500);
			mobPhone.println(PHONE_SEND_SMS);     // Sends message at index of 1
		}
		gblSMSElapsed = millis();
      }

  } else {
    LED_Status(LED_OFF,0);
    LED_Status(LED_GREEN,500);
  }
  
  phoneTX();
  LED_Status(LED_OFF,0);
}