I saw a intractables https://www.instructables.com/Play-Songs-With-Arduino-Using-ADC-to-PWM-on-Flybac/ and was going to get the code at the bottom but after opening the .ino it gave me the weird binary code stuff. Is there anywhere else I can find the code or is there a way to open the .ino to get the regular code? I
Your link is broken
how about now?
I opened the file, the .ino is fine.
/*
Created by ISandhu
*/
#define _DISABLE_ARDUINO_TIMER0_INTERRUPT_HANDLER_ //Please read instruction to see what this line means
//otherwise you'll get error during compiling and uploading.
void ADC_setup(){
ADMUX=0;
ADMUX|=(1<<ADLAR) |(1<<REFS0);
ADCSRA|=(1<<ADEN) | (1<<ADIE) | (1<<ADPS2) | (ADPS0<<1);
ADCSRB|=(1<<ADTS2);
DIDR0|=(1<<ADC0D);
ADCSRA|=(1<<ADATE) | (1<<ADSC);
}
void CW_setup(){//Carrier Wave Setup
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
TCCR1A=0;
TCCR1B=0;
TCCR1A |=(1<<COM1A1) | (1<<WGM11);
TCCR1B |= (1<<CS10) | (1<<WGM12) | (1<<WGM13);
ICR1=258;
OCR1A=128;
}
void SI_setup(){//Sample Interrupt Setup
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
TCCR0A=0;
TCCR0B=0;
TCNT0=0;
TCCR0A |=(1<<COM0A1) |(1<<WGM00) | (1<<WGM01);// (1<<COM0B1) |
TCCR0B |= (1<<CS01) | (1<<WGM02);
TIMSK0|=(1<<TOIE0);
OCR0A=60; //Sample Freq=33.37KHz
}
void setup() {
cli();
SI_setup();
CW_setup();
ADC_setup();
sei();
}
ISR(TIMER0_OVF_vect){
}
ISR(ADC_vect){
OCR1A=ADCH;
}
void loop() {
}