This file contains 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 = 26; // speaker on digital pin 26 | |
float frequencies[] = {146.8, 146.8, 146.8, 174.6, 196, 220, 146.8, 146.8, 246.94, 220, 196, 220, 220, 220, 164.8, 220, 164.8, 174.6, 146.8, 174.6, 220, 164.8, 164.8, 174.6, 220, 261.6, 246.9, 220, 196, 174.6, 174.6, 196, 196, 164.8, 130.8, 440, 440, 493.9, 440, 415.3, 440, 587.3, 493.9, 392, 329.6, 440, 293.6}; | |
float durations[] = {0.3, 0.05, 0.05, 0.2, 0.2, 0.4, 0.2, 0.2, 0.4, 0.2, 0.2, 0.4, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4, 0.2, 0.2, 0.4, 0.2, 0.2, 0.6, 0.2, 0.3, 0.1, 0.2, 0.2, 0.6, 0.2, 0.3, 0.1, 0.2, 0.2, 0.6, 0.3, 0.1, 0.2, 0.2, 0.4, 0.4, 0.2, 0.2, 0.2, 0.2, 0.4}; | |
int musicLength = sizeof(frequencies) / sizeof(frequencies[0]); | |
float delayInMicroseconds; | |
int numberOfIterations; |
This file contains 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 = 26; // speaker on digital pin 26 | |
float frequency = 440; // in hertz. 440Hz is the note A4 | |
float duration = 2; // in seconds | |
// Period is the inverse of frequency, measured in seconds. | |
// To obtain microseconds we multiply by 1 million. | |
// And to obtain half of period | |
// (the time in either "on" or "off" state), we divide by 2. | |
float delayInMicroseconds = 1/frequency*1000000/2; |
This file contains 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 = 26; // speaker on digital pin 26 | |
void setup() { | |
pinMode(speakerPin, OUTPUT); | |
} | |
void loop() { |
This file contains 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 = 26; // speaker on digital pin 26 | |
float frequencies[] = { | |
130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, 130.8, 164.8, 196, | |
220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, 220, 261.6, 329.6, | |
146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, 146.8, 174.6, 220, | |
196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7, 196, 247, 293.7}; | |
float durations[] = { | |
0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0 |
This file contains 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 = 26; // speaker on digital pin 26 | |
int coarseTune, fineTune, duty, coarseDuty, fineDuty; | |
void setup() { | |
pinMode (speakerPin, OUTPUT); | |
pinMode (A4, INPUT); // coarse potentiometer on analog pin A4 | |
pinMode (A5, INPUT); // fine potentiometer on analog pin A5 | |
pinMode (A6, INPUT); // duty cycle potentiometer on analog pin A6 | |
} |
This file contains 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
import serial | |
import sys | |
from datetime import datetime, date | |
ourSerial = serial.Serial() | |
ourSerial.port = '/dev/ttySC1' | |
ourSerial.baudrate = 4800 | |
ourSerial.bytesize = serial.EIGHTBITS | |
ourSerial.parity = serial.PARITY_NONE | |
ourSerial.stopbits = serial.STOPBITS_ONE |
This file contains 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
import serial | |
import sys | |
ourSerial = serial.Serial() | |
ourSerial.port = '/dev/ttySC1' | |
ourSerial.baudrate = 4800 | |
ourSerial.bytesize = serial.EIGHTBITS | |
ourSerial.parity = serial.PARITY_NONE | |
ourSerial.stopbits = serial.STOPBITS_ONE | |
ourSerial.xonxoff = False |
This file contains 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
* makes beeps | |
ORG $300 | |
LDA #$FF | |
STA FREQ | |
LDA #$80 | |
STA PLSWIDTH | |
PLAY LDA $C030 | |
LDY PLSWIDTH | |
PULSE DEY |
This file contains 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
* makes beeps | |
ORG $300 | |
LDA #$FF | |
STA FREQ | |
LDA #$80 | |
STA PLSWIDTH | |
PLAY LDA $C030 | |
LDY PLSWIDTH | |
PULSE DEY |
This file contains 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
org $8000 | |
start: ld a,%00010000 ; load accumulator with any value that sets the 4th bit | |
out (&fe),a ; send that value to port 254, i.e. hexadecimal FE | |
end start |
OlderNewer