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

Touch Sensors Module Pseudocode - Notepad

This module initializes three touch sensor pins as digital inputs and contains functions to check for presses on each sensor. When a sensor is pressed, it creates a TOUCH_SENSOR_PRESS event with a parameter indicating which sensor was pressed and posts it to the GameProgressionService.

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)
72 views1 page

Touch Sensors Module Pseudocode - Notepad

This module initializes three touch sensor pins as digital inputs and contains functions to check for presses on each sensor. When a sensor is pressed, it creates a TOUCH_SENSOR_PRESS event with a parameter indicating which sensor was pressed and posts it to the GameProgressionService.

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

Touch Sensors Module Pseudocode

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

// set LastTouchState to 0 initially for all 3 touch sensors

// this init function is called from GameProgressionService


InitLightSensors:
set RA2, RA3, RA4 to digital inputs

CheckTouchSensor1Press:
read current touch sensor value of RA2
if CurrentSensorState is different from LastTouchStatefor sensor 1 and the
CurrentSensorState is 1:
creae new TOUCH_SENSOR_PRESS event
set EventParam to 1 // to indicate which touch sensor was pressed
post event to GameProgressionService

CheckTouchSensor2Press:
read current touch sensor value of RA3
if CurrentSensorState is different from LastTouchStatefor sensor 2 and the
CurrentSensorState is 1:
creae new TOUCH_SENSOR_PRESS event
set EventParam to 2 // to indicate which touch sensor was pressed
post event to GameProgressionService

CheckTouchSensor3Press:
read current touch sensor value of RA4
if CurrentSensorState is different from LastTouchStatefor sensor 3 and the
CurrentSensorState is 1:
creae new TOUCH_SENSOR_PRESS event
set EventParam to 3 // to indicate which touch sensor was pressed
post event to GameProgressionService

You might also like