Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NimaBoscarino/042fb625b5c9117778d50f9e254ea17c to your computer and use it in GitHub Desktop.
Save NimaBoscarino/042fb625b5c9117778d50f9e254ea17c to your computer and use it in GitHub Desktop.
#include <LittleRobotFriends.h>
boolean soundOn = false;
Int freq = 100;
void myTapHandler(LRFEvent event) {
soundOn = !soundOn;
}
void setup()
{
lrf.setup();
lrf.disableEventExpressions();
lrf.setBoredomTimer(0);
lrf.setEventHandler(LRFEvent_Tap, &myTapHandler);
}
void loop()
{
lrf.loop();
if (soundOn) {
if (lrf.motion.readX() > 5) {
freq++;
}
else if (lrf.motion.readX() < - 5) {
freq--;
}
lrf.speech.setFrequency(freq);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment