Hi
Please let me know how can I save my sensor data readings from telosb into
a text file?
PFA the code I have been using. But it only displays the sensor readings on
the serial port terminal in ubuntu.
I need to take say around 1000 light sensor readings and save it in a text
file.
Please help me out in this..
Thanks
Bhagyeshwari Chauhan
B. Tech, 3rd year
Electronics and Communication Engineering
Member, IEEE Student Branch.
Core member,E-cell
Astronomy Club
The LNM Institute Of Information Technology
Jaipur , Rajasthan-302031 , India
Alternate E-mail: [email protected]
--
configuration TempTestAppC
{
}
implementation
{
//general components
components TempTestC as App;
components MainC, LedsC;
components new TimerMilliC();
//wiring
App.Boot -> MainC;
App.Leds -> LedsC;
App.Timer -> TimerMilliC;
//For writing into serial port-using print function
components SerialPrintfC;
//Temperature component
components new SensirionSht11C() as TempSensor;
App.TempRead -> TempSensor.Temperature;
//Light component
components new HamamatsuS10871TsrC() as LightSensor;
App.LightRead -> LightSensor;
}
#include<Timer.h>
#include<stdio.h>
#include<string.h>
module TempTestC
{
uses
{
//General interfaces
interface Boot;
interface Timer<TMilli>;
interface Leds;
//Read
interface Read<uint16_t> as TempRead;
interface Read<uint16_t> as LightRead;
}
}
implementation
{
uint16_t centiGrade; //defining a variable here to do the conversion in it!
uint16_t luminance;
event void Boot.booted()
{
call Timer.startPeriodic(1000);
call Leds.led1On();
}
event void Timer.fired()
{
if(call TempRead.read() == SUCCESS)
{
call Leds.led2Toggle();
}
else
{
call Leds.led0Toggle();
}
if(call LightRead.read() == SUCCESS)
{
call Leds.led2Toggle();
}
else
{
call Leds.led0Toggle();
}
}
event void TempRead.readDone(error_t result, uint16_t val)
{
if(result == SUCCESS)
{
centiGrade = (-39.60 + 0.01 * val);
printf("Current temp is %d \r\n",centiGrade);
}
else
{
printf("Error reading from sensor!! \r\n");
}
}
event void LightRead.readDone(error_t result, uint16_t val)
{
if(result == SUCCESS)
{
luminance = 2.5* (val/4096.0) * 6250.0;
printf("Current light is %d \r\n",luminance);
}
else
{
printf("Error reading from sensor!! \r\n");
}
}
}_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help