This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;Enable unmasked peripheral interrupts | |
| INTCON = %11000000 | |
| ;Declear interrupt handler | |
| ON INTERRUPT goto Serial_Interrupt | |
| ;Enable interrupt on USART (Serial Receive) | |
| PIE1.5 = 1 | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int speakerPin = 5; | |
| int length = 26; | |
| char notes[] = "eeeeeeegcde fffffeeeeddedg"; | |
| int beats[] = { 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2}; | |
| int tempo = 300; | |
| void playTone(int tone, int duration) { | |
| for (long i = 0; i < duration * 1000L; i += tone * 2) { | |
| digitalWrite(speakerPin, HIGH); | |
| delayMicroseconds(tone); |
OlderNewer