The Quorum Studio Coding window for this lesson appear here with the lines of code and comments. Look for link named Full Code as Text with Comments to get the same information in text.

Touch21 This time we let the touch sensor work with the motors. Be sure have the sensor pointing in the direction of motion and is sticking out beyond the body of the robot. The sounds in this example let you know when the switch has be activated they also create time for the motors to backup and the turn the robot around. There are no new commands or ideas in the lesson.

Click here to see the code without comments to copy &paste. ==>
//just the code no comments
use Libraries.Robots.Lego.Button
use Libraries.Robots.Lego.Sounduse Libraries.Robots.Lego.TouchSensoruse Libraries.Robots.Lego.MotorButton buttonSound soundTouchSensor touchMotor motortouch:SetPort(1) motor:SetSpeed("B",60)motor:SetSpeed("C",60)repeat until button:IsButtonPressed(button:ESCAPE_BUTTON) motor:RotateForward("B") motor:RotateForward("C") if touch:IsPressed() motor:RotateBackward("B") motor:RotateBackward("C") sound:PlayTone(440,500) sound:PlayTone(220,500) motor:RotateForward("B") motor:RotateBackward("C") sound:PlayTone(880,333) sound:PlayTone(440,333) endend
Sample Video appears to the right.Scroll down to see student summited videos


Student Videos

GITHUB BUTTON HERE