How do I send station output to a file on disk?

315MHz and 433MHz wireless connections are very commonly used by consumer electronics including weather stations, home automation remote controls, power consumption meters, car alarms, and also many DIY projects.
Post Reply
rachalmers
Posts: 15
Joined: Thu Jul 24, 2014 3:01 pm
Location: Suffolk, England
Contact:

How do I send station output to a file on disk?

Post by rachalmers » Fri Aug 08, 2014 11:35 am

I'm trying to figure out how to send the output of the weather station program to a file so I can then use it in other programs.

Actually ... I don't think I can. So what I will just do is either capture it from the serial output with a little C program, or read it directly into the station.



This prints it to the serial monitor fine. How do I get it to save it to disk (Mac/Unix)
What includes do I need other than those shown below this?

Code: Select all

	#ifdef DEBUG
	usart_puts_P(PSTR("Weather Station Receiver has powered up (v"));
	utoa(build, buffer, 10);
	usart_puts(buffer);
	usart_puts_P(PSTR(")\r\n"));
	usart_puts_P(PSTR("Debug enabled\r\n"));
	#endif

Code: Select all

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdlib.h>
The code writing to the monitor.

Code: Select all

	  //Send the data to the serial port
		utoa(bWSR_StationTransmitterID, buffer, 10);
		usart_puts(buffer);
		putchar(',');
		utoa(bWSR_ExpectedData, buffer, 10);
		usart_puts(buffer);
		putchar(',');
		utoa(bWSR_ValidData, buffer, 10);
		usart_puts(buffer);
		putchar(',');
		if (bWSR_ValidData & WSR_RCVD_TEMP_BIT)
		{
			itoa(siWSR_CurrentTemperature/10, buffer, 10);
			usart_puts(buffer);
			putchar('.');
			utoa(siWSR_CurrentTemperature%10, buffer, 10);
			usart_puts(buffer);
		}
		putchar(',');
		if (bWSR_ValidData & WSR_RCVD_HUM_BIT)
		{
			utoa(bWSR_CurrentHumidity, buffer, 10);
			usart_puts(buffer);
		}
		putchar(',');
		if (bWSR_ValidData & WSR_RCVD_RAIN_BIT)
		{
			utoa(uiWSR_RainfallCount, buffer, 10);
			usart_puts(buffer);
		}
		putchar(',');
		if (bWSR_ValidData & WSR_RCVD_GUST_BIT)
		{
			usart_puts(strWindDirection[bWSR_CurrentGustDirection]);
			putchar(',');
			utoa(uiWSR_CurrentGustSpeed_m_per_sec/10, buffer, 10);
			usart_puts(buffer);
			putchar('.');
			utoa(uiWSR_CurrentGustSpeed_m_per_sec%10, buffer, 10);
			usart_puts(buffer);
		}
		putchar(',');
		if (bWSR_ValidData & WSR_RCVD_WIND_BIT)
		{
			usart_puts(strWindDirection[bWSR_CurrentWindDirection]);
			putchar(',');
			utoa(uiWSR_CurrentWindSpeed_m_per_sec/10, buffer, 10);
			usart_puts(buffer);
			putchar('.');
			utoa(uiWSR_CurrentWindSpeed_m_per_sec%10, buffer, 10);
			usart_puts(buffer);
		}

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests