Popular posts from this blog
DAY 17
/* ------------------------------------------------------------- */ /* This program stores fingerprint information in a structure. */ /* It then references a function to compute the overall category.*/ #include <stdio.h> /* Define a structure for the fingerprint information. */ /* The order for fingertips is right hand, thumb to pinky, */ /* and left hand, thumb to pinky. The codes are L for loops, */ /* W for whorls, and A for arches. */ struct fingerprint { int ID_number; double overall_category; char fingertip[10]; }; int main(void) { /* Declare and initialize variables. */ struct fingerprint new_print; double compute_category(struct fingerprint f); int k, w_num = 0, l_num = 0, a_num = 0; float w_per, l_per, a_per; /* Specify information for the new fingerprint. */ new_print.ID_number = 2491009; new_print.overall_category = 0; new_print.fingertip[0] = 'W'; new_print.fingertip[1] = 'L...
day 19
LAB #include <TimerOne.h> #include "pitches.h" const int BUTTON_INT = 0; const int SPEAKER = 12; volatile int key = NOTE_C2; volatile int octave_multiplier = 1; long timer = 500000; void setup() { Serial.begin(9600); pinMode(SPEAKER, OUTPUT); attachInterrupt(BUTTON_INT, changeKey, RISING); Timer1.initialize(timer); Timer1.attachInterrupt(changePitch); } void changeKey() { octave_multiplier = 1; if (key == NOTE_C2) key = NOTE_D2; else if (key == NOTE_D2) key = NOTE_E2; else if (key == NOTE_E2) key = NOTE_F2; else if (key == NOTE_F2) key = NOTE_G2; else if (key == NOTE_G2) key = NOTE_A2; else if (key == NOTE_A2) key = NOTE_B2; else if (key == NOTE_B2) key = NOTE_C2; timer -= 10000; Timer1.initialize(timer); } void changePi...


Comments
Post a Comment