Try this. If Galileo is really slow, then you might have to tweak it.
- void beep (unsignedchar speakerPin,int frequencyInHertz,long timeInMilliseconds)
- { // http://web.media.mit.edu/~leah/LilyPad/07_sound_code.html
- int x;
- long delayAmount =(long)(1000000/frequencyInHertz);
- long loopTime =(long)((timeInMilliseconds*1000)/(delayAmount*2));
- for(x=0;x<loopTime;x++)
- {
- digitalWrite(speakerPin,HIGH);
- delayMicroseconds(delayAmount);
- digitalWrite(speakerPin,LOW);
- delayMicroseconds(delayAmount);
- }
- }
- Also see RoboBrrd-Mesh-Network--Pulse-Sensor/LearningPet_XNP/LearningPet_XNP.ino at master · RobotGrrl/RoboBrrd-Mesh-Network--Pulse-Sensor · GitHub