0% found this document useful (0 votes)
67 views1 page

Light Sensors Module Pseudocode - Notepad

This module handles initializing three light sensor pins as digital inputs and contains functions to check if each light sensor has been activated by reading the pin values and posting an event if activated.

Uploaded by

api-581468038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views1 page

Light Sensors Module Pseudocode - Notepad

This module handles initializing three light sensor pins as digital inputs and contains functions to check if each light sensor has been activated by reading the pin values and posting an event if activated.

Uploaded by

api-581468038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Light Sensors Module Pseudocode

/*
This module handles initializing the light sensor pins as digital inputs and
contains the 3 event checkers for each light sensor.
*/

// set LastLightState to 0 initially for all 3 light sensors

// this init function is called from GameProgressionService


InitLightSensors:
set RB11, RB12, RB13 to digital inputs

CheckLightSensor1Activated:
read current touch sensor value of RB11
if CurrentSensorState is different from LastLightState for sensor 1 and the
CurrentSensorState is 0:
creae new LIGHT_SENSOR_ACTIVATED event
set EventParam to 1 // to indicate which light sensor was activated
post event to GameProgressionService

CheckLightSensor2Activated:
read current touch sensor value of RB12
if CurrentSensorState is different from LastLightState for sensor 2 and the
CurrentSensorState is 0:
creae new LIGHT_SENSOR_ACTIVATED event
set EventParam to 2 // to indicate which light sensor was activated
post event to GameProgressionService

CheckLightSensor3Activated:
read current touch sensor value of RB13
if CurrentSensorState is different from LastLightState for sensor 3 and the
CurrentSensorState is 0:
creae new LIGHT_SENSOR_ACTIVATED event
set EventParam to 3 // to indicate which light sensor was activated
post event to GameProgressionService

You might also like