Data Sheet

69 : circuit 3c
NO TONE
FUNCTION:
noTone(pin_number);
In circuit 2A, you made songs using a buzzer and the tone()
function, but you gave the function three parameters: a pin
number, a frequency and a duration. You can leave out the third
parameter, and the tone will play until you change it or turn it
off. noTone() turns off a pin that has been activated with the
tone() command.
CODING CHALLENGES
CHANGE THE SERVO BEHAVIOR: Try changing the way your servo behaves
when the distance sensor is triggered.
CHANGE THE ALARM SETTINGS: Try altering the code so the alarm goes off
from much farther or closer distances.
ADD A SECOND MECHANISM: Time to use your imagination! Try your hand
at making different objects move with your servo motor. Don’t have a cat? Make an
interactive pop-up story, room alarm, treat dispenser or automatic fish feeder.
TROUBLESHOOTING
The RGB LED colors aren’t
working or a color is
missing
Check the connection for the wire and resistor connected to
each leg of the LED. Ensure the RGB LED is inserted in the
correct orientation.
The distance sensor
doesn’t seem to work
Open up the Serial Monitor on your computer. You should
see a stream of distances being printed in the monitor. If
they are all reading 0 or jumping around, check the wiring
on your sensor.
The distance sensor still
doesn’t work
Ultrasonic noise pollution will interfere with your
distance sensor readings. If you aim two distance
sensors at each other, they will confuse each other.
Some air-conditioning systems may also emit noises
in the ultrasonic range. Try pointing your sensor
away from the other distance sensors or moving to a
different location.
CODE TO NOTE
SIK v4 Book Oct 13.indb 69 10/18/17 10:01 AM