Thursday, 11 October 2012

a quick demo CO2 + Telosb




Change following lines in sky/dev/light-sensor.c

#define INPUT_CHANNEL      (1 << INCH_0)#define INPUT_REFERENCE     SREF_0
#define PHOTOSYNTHETIC_MEM  ADC12MEM0
#define TOTAL_SOLAR_MEM     ADC12MEM0

Then, the light sensor channel is redirected into CO2.

I try to creat a new sensor file in Contiki for Telosb, but it alway fails.
Any one know offical documents about this issues? Thanks for the help

Monday, 1 October 2012

write-USB Contiki OS Telosb

#include "dev/serial-line.h"
PROCESS(gas_client, "GAS Client Process");
AUTOSTART_PROCESSES(&gas_client);

/*----------------------------------------------------------------------------*/
PROCESS_THREAD(gas_client, ev, data)
{
    PROCESS_BEGIN();
  //  bootup();
   // printf("Welcome to GAS Client process!\n");
    uint8_t command_str[10] = {'\0'};
   // uint8_t contents[10] = {'\0'};
    while(1) {
      
        PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL);

        strcpy( command_str, (uint8_t *) data);
        printf( "\nReceived command %s", command_str);
      
       // if (strncmp(command_str, ADDR_C, 2) == 0) {
                   
       // }
       
       //   strcpy(command_str, "");
    }
    PROCESS_END();
}



Terminal1:
echo "hello" > /dev/ttyUSB4
Terminal2:
make login
Received command hello