/* * -------------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 23): * As long as you retain this notice you can do whatever you want with this stuff. * If we meet some day, and you think this stuff is worth it, you can buy me a beer * in return. Niklas Roy. * Revision 23 is based on revision 42 of this license by Poul-Henning Kamp * * Please note that this code is a quick hack, which is only poorly commented and * meant for reference use only. * * Code is written in AVR-GCC and runs on an ATmega8 with 1MHz internal oscillator. * -------------------------------------------------------------------------------- */ #define F_CPU 1000000UL #define STOP_L 186 #define STOP_R 131 #define STOP OCR1A =3000;OCR1B =3000; #define LED1ON PORTC |= (1< #include #include uint8_t obstacle(); void makesound(); int8_t velocity=1; uint8_t sound=100; uint8_t sound_count=0; uint16_t note_count; uint8_t note_speed=4; uint8_t general_count=0; uint8_t g_count2=0; uint8_t redo=0; int8_t curve=0; int main(void){ TCCR1A |= (1<19) obs_tf=1; return obs_tf; } void makesound(){ note_count+=note_speed; sound_count+=3; if (sound_count>=sound) { sound_count=0; PORTD ^= (1<180) sound/=2; if (sound<40) sound=sound*3+1; curve= (random()%70)-35; note_speed=(random()%8+1); } }