As overall GOLEM is programmed to follow the following tasks and each task is explains by the following diagram:
i) Move along the black line by using the light sensor if no is sound detected.
Light sensor can differentiate the colour between black and white, accurately. Pitch-black colour value is read as smaller value (0 – 30) while lighter number value is higher (55 – 100). The value is set to <45,>
But if the light sensor is not detecting line (white floor), light sensor will read the white colour as above than 45 and automatically stop the motor A and runs motor B continuously until the light sensor reads black again. So the motors will rotating and make zigzag moving pattern that moves the robot.
ii) Turn right if the sound is higher than 60 dBa by using the sound sensor OR turn left if the sound is less than 30 dBa by using the sound sensor.
Adjustable Decibel (dBA) is a reading value for normal sound that human ears can hear. If GOLEM hears whistle sound that exceeding 70 dBA, it will automatically turn right by steering motor A and B simultaneously and make GOLEM turns the direction to right, instead of straight.
From here on, GOLEM will ignore the light sensor command until the sound fade away. If the sound read as less than 50 dBA (but not less than 20 dBA), the motor will steering to the left. This shows that the sound level determining the direction.
GOLEM also produces sounds TO RIGHT or TO LEFT while changing directions.
iii) Hit (rotating motor A) any object in proximity that using ultrasonic sensor to locate the object distance and direction.
Since this program is switch-based programming, it allows the blocks to operate continuously for every switch. During the track, if GOLEM ultrasonic sensor detecting any objects/obstacles it will start rotating motor C that functioning as GOLEM’s arm. The distance between the object and the ultrasonic sensor is set as 28cm. The object in this distance will trigger the motor and abruptly swing the claw to eliminate the object.
While running, all processes above are set in infinity or forever loop that makes GOLEM runs the program as non-stop until it manually stopped from the NXT button.
So, that's all about programming. Hasta luego..!