All pastes #1028362 Raw Edit

Untitled

public text v1 · immutable
#1028362 ·published 2008-05-25 00:04 UTC
rendered paste body
/*
 * Ping
 * ===========
 * Reads light level into level, transmitts it out via SendMessage.
 *
 * Mapping:
 *   OUT_A: empty
 *   OUT_B: empty
 *   OUT_C: empty
 *    IN_1: empty
 *    IN_2: light sensor
 *    IN_3: empty
 *
 */

#define THRESHOLD 70

int level;

task Ping

{
  while(true)
  {
    level = Input(1);
    if(level > THRESHOLD)
      PlaySound(1);
    SendMessage(level);
  }
}

task main
{
  // Set up the sensors
  Sensor(IN_2,IN_CFG(STYPE_LIGHT, SMODE_PERCENT));

  // Start Tasks
  start Ping;
}