Hallo
Im Gegensatz zu beep() erzeugt sound() eine zusätzliche Pause nach dem Ton. Die Funktion in RP6ControlLib.h:
#define sound(_pitch_,_time_,_delay_) {beep(_pitch_,_time_);mSleep(_delay_ + _time_);}
Das bedeutet, sound(tonhöhe, dauer, pause) macht das: beep(tonhöhe, dauer); mSleep(pause);
Beschrieben wird das in RP6ControlLib.c beim beep():
Mehr Infos zu beep():Code:/** * You can use this function to make the beeper beep ;) * But this function should not be used as it does not * generate a delay for the sound and a delay between * two sounds. Better is to use the "sound" macro, which * uses this function and adds the required delays. * * "sound(pitch,time,delay)" * * 0 = lowest frequency * 255 = highest frequency * * Example: * sound(150,50,25); * sound(200,50,25); * * Of course the function "beep" is nice to generate * sounds when you need to do other things at the same * time... */ void beep(uint8_t pitch, uint16_t time) { controlStatus.beep = true; sound_timer = time; OCR2 = 255-pitch; TCCR2 = (1 << WGM21) | (1 << COM20) | (1 << CS22) | (1 << CS21); }
https://www.roboternetz.de/community...z-beim-Beeper?
Gruß
mic






Zitieren

Lesezeichen