Hi all,

I don't understand the readings I get when I try to sense light by using
PhotoC().

I am using mica2 on tinyos-2.0. Now what I did was I made few changes to the
Oscilloscope example. So now I am wondering if the way I tried to sense light is
even correct!?

what I did is the following:
After coping all the Photo files from /opt/tinyos-2.x/tos/sensorboards/basicsb
to the Oscilloscope directory:

Firstly, in the OscilloscopeAppsC.nc file:
I left everything as it is, except I changed the new DemoSensorC() as Sensor to
new PhotoC() as Sensor.
so when i did the wiring, I changed it to OscilloscopeC.LightRead -> Sensor;
configuration OscilloscopeAppC { }
implementation
{
  components OscilloscopeC, MainC, ActiveMessageC, LedsC,
    new TimerMilliC(), new PhotoC() as Sensor,
    new AMSenderC(AM_OSCILLOSCOPE), new AMReceiverC(AM_OSCILLOSCOPE);

  ......
  OscilloscopeC.LightRead -> Sensor;
  ......

}

Secondly, in the OscilloscopeC.nc:
I also left everything as it is, I only changed few lines:
module OscilloscopeC
{
  uses {
    ....
    interface Read<uint16_t> as LightRead;
    ....
  }
}

then I changed the Time.fired event:
  event void Timer.fired() {
    .......
    if (call LightRead.read() != SUCCESS)
      report_problem();
  }

then changed the Read event to LightRead
  event void LightRead.readDone(error_t result, uint16_t data) {
    if (result != SUCCESS)
      {
        data = 0xffff;
        report_problem();
      }
    local.readings[reading++] = data;
  }

These are the only changes I added.. so should that give me light readings or am
 I on the wrong track here?? any advice would be greatly appreciated.

Thanks all.

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to