Finch Security

Targeted Concept(s): 
Conditionals
Supported Language(s): 
Java

Program Name: FinchSecurity.java
Objective: Using the if-else and looping.

Use the Finch as its own security system. Place the Finch in front of a door. Using the object sensors while the door is shut just blink a red led but if the door is open (obstacle gone) then the Finch will go crazy with light, sounds and movements.

Commands:
Put this under Finch Init: boolean[] sense = new boolean[2];
Finch Sense: sense = myFinch.getObstacleSensors();
If the door is opened: if(!(sense[0] || sense[1])) {
Break out of infinite loop: break;
If/else if/else: if(condition) {
actions
} else {
actions
}
While Loop: while(condition) {
actions
}

Comments

It was funny watching it go

It was funny watching it go crazy

Will the mechanism also works

Will the mechanism also works on the standard type of door? Looks that unique to try and seem good to have. You can see the sample from here at http://caldwells.com/.

Thanks.

Elementary Programming

Thanks for sharing an accessible (very do-able) assignment/program for my elementary students:)