![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Level 2 Project Range Device
Dependencies: N5110 SDFileSystem SRF02 TMP102 mbed
Fork of Ranger by
Diff: main.cpp
- Revision:
- 9:bc259fc22fa2
- Parent:
- 8:fe6ebe807b9d
- Child:
- 10:c9f3c22368f1
--- a/main.cpp Wed Apr 27 09:09:55 2016 +0000 +++ b/main.cpp Wed May 04 14:05:07 2016 +0000 @@ -6,65 +6,49 @@ #include "main.h" #include "SDFileSystem.h" -//Serial serial(USBTX, USBRX); // for PC debug - +Serial serial(USBTX, USBRX); // for PC debug int main() { int d = 0; - int myarray[9]; + int myarray[5] {9,9,9,9,9}; /// initilised to any possitive integer to prevent random values at start up triggering an alert setup(); lcd.init(); // Initiate LCD - /* - sprintf(buffer,"ELEC 2645"); - sprintf(buffer1,"Project Ranger"); - sprintf(buffer2,"Phil Thompson"); - sprintf(buffer3,"SID 200971914 "); - lcd.printString(buffer,0,0); - lcd.printString(buffer1,0,1); - lcd.printString(buffer2,0,2); - lcd.printString(buffer3,0,3); - wait (3); - */ - /* + + sprintf(buffer,"ELEC 2645"); + sprintf(buffer1,"Project Ranger"); + sprintf(buffer2,"Phil Thompson"); + sprintf(buffer3,"SID 200971914 "); + lcd.printString(buffer,0,0); + lcd.printString(buffer1,0,1); + lcd.printString(buffer2,0,2); + lcd.printString(buffer3,0,3); + wait (3); + serial.baud(115200); // full-speed! - serial.printf("#### SD Card Example #####\n"); + serial.printf("#### SD TESTING #####\n"); FILE *fp; // this is our file pointer wait(1); - { - /////////////////////// Reading from file example //////////////////////// + + + +/////////////////////// Reading from file example //////////////////////// - // now open file for reading...note the 'r' - fp = fopen("/sd/settings.txt", "r"); - if (fp == NULL) { // if it can't open the file then print error message - serial.printf("Error! Unable to open file!\n"); - } else { - serial.printf("Reading file....\n"); - int r1; - int r2; - int r3; - int r4; - int r5; - int r6; - int r7; - int offset; - float bright; - float value; - int i; + // now open file for reading...note the 'r' + fp = fopen("/sd/settings.txt", "r"); + if (fp == NULL) { // if it can't open the file then print error message + serial.printf("Error! Unable to open file!\n"); + } else { + serial.printf("Reading file....\n"); - // in this example, we keep reading (using fscanf) until we reach - // the 'end of file'. Note we use the address operator & to write - // to the variables. Also the format of the string must match what - // is in the file - while (fscanf(fp, "%d,%f", &i, &value) != EOF) { - serial.printf("%d,%f\n",i,value); - } - serial.printf("Done.\n"); - fclose(fp); // ensure you close the file after reading - } + while (fscanf(fp, "%f,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,",&bright,&units,&offset,&check_flag,&r1,&r2,&r3,&r4,&r5,&r6,&r7) != EOF) { + serial.printf("%f,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i, \n",bright,units,offset,check_flag,r1,r2,r3,r4,r5,r6,r7); + } + serial.printf("Done.\n"); + fclose(fp); // ensure you close the file after reading } - */ - + lcd.setBrightness(bright); + wait (3); while(1) { if (g_sw1_flag) { /// Event triggered inturupt to call the menu and reset page numbers @@ -76,42 +60,47 @@ } if (g_timer_flag_srf02) { - g_timer_flag_srf02 = 0; // if it has, clear the flag - if (units == METRIC) { + if (units == 1) { distance = srf02.getDistanceCm(); distance = distance-(offset*c); } else { distance = srf02.getDistannceInch(); - distance = distance -(offset*c); - } + distance = distance -(offset*c); //MAYBE MOVE C TO OFSET SETTING + }// close else breaket + } // close if inteurrupt bracket - if (d == 10) { - d = 0; - } else { - d++; - } - myarray[d] = distance; - int totaldistance = 0; - for (int i = 0; i < 9; i++) { - int totaldistance = totaldistance+myarray[i]; - } - avgdistance = totaldistance/9; + if (d == 4) { + d = 0; + } else { + d++; } + myarray[d] = distance; + // serial.printf("ARRAY ELEMENT = %i", d); + // serial.printf("myarray %i", myarray[d]); + totaldistance =0; + for (int i = 0; i < 6; i++) { + totaldistance = totaldistance + myarray[i]; + } + avgdistance = (totaldistance/5); + + // serial.printf("TOATAL DISTANCE %i\n", totaldistance); + // serial.printf("DISTANCE %i\n", distance); + // serial.printf("AVERAGE DISTANCE %f\n", avgdistance); setalert(); + // serial.printf("ALERT LEVEL %i\n", alert); lcdoutput(); - if (!alert == 0) { - if (buzz_flag == 0) { - setbuzzer(); - } - } + // if (alert !=0) { + // if (buzz_flag == 0) { + // setbuzzer(); + // } + // } setleds(); sleep(); } } - void lcdoutput() { /** @@ -123,98 +112,94 @@ // if alert == 0 no need to display range path is clear if (alert == 0) { + lcd.clear(); if (g_timer_flag_standby) { g_timer_flag_standby = 0; - T = tmp102.get_temperature(); + Traw = tmp102.get_temperature(); standby++; - if (standby >3) { - standby = 3; + if (standby >2) { + standby = 2; } } - switch (standby) { + case 0: + if (check_flag == 1) { + sprintf(buffer5,"COLLISIONCHECK"); + } + sprintf(buffer,"**PATH CLEAR**"); + lcd.printString(buffer,0,5); + lcd.printString(buffer,0,0); + lcd.refresh(); + break; case 1: if (check_flag == 1) { - sprintf(buffer4,"COLLISIONCHECK"); + sprintf(buffer5,"COLLISIONCHECK"); + lcd.printString(buffer5,0,5); } - lcd.clear(); - sprintf(buffer,"**PATH CLEAR**"); - lcd.printString(buffer,0,0); - lcd.printString(buffer4,0,5); + if (units == 0) { + T = (Traw*1.8000)+32.00; + sprintf(buffer3,"TEMP = %.2fF",T); + sprintf(buffer2,"TEMPERATER"); + } else { + T=Traw; + sprintf(buffer3,"TEMP = %.2fC",T); + sprintf(buffer2,"TEMPERATER"); + } + lcd.printString(buffer3,4,3); + lcd.printString(buffer2,12,2); lcd.refresh(); break; case 2: if (check_flag == 1) { - sprintf(buffer4,"COLLISIONCHECK"); + sprintf(buffer5,"COLLISIONCHECK"); + lcd.printString(buffer5,0,5); } - lcd.clear(); - sprintf(buffer3,"TEMP = %.2f",T); - sprintf(buffer2,"TEMPERATER"); - lcd.printString(buffer3,4,2); - lcd.printString(buffer2,12,1); - lcd.printString(buffer4,0,5); - - break; - case 3: - if (check_flag == 1) { - sprintf(buffer4,"COLLISIONCHECK"); + if (units == 0) { + T = (Traw*1.8000)+32.00; + sprintf(buffer3,"TEMP = %.2fF",T); + sprintf(buffer2,"TEMPERATER"); + } else { + T=Traw; + sprintf(buffer3,"TEMP = %.2fC",T); + sprintf(buffer2,"TEMPERATER"); } - lcd.clear(); - sprintf(buffer3,"TEMP = %.2f",T); - sprintf(buffer2,"TEMPERATER"); + lcd.printString(buffer3,4,3); + lcd.printString(buffer2,12,2); lcd.refresh(); - lcd.printString(buffer3,4,2); - lcd.printString(buffer2,12,1); - lcd.printString(buffer4,0,5); lcd.setBrightness(0); break; - } - } - - //If alert isn't 0 then the distance is to be dispayed alonng with the the distance bar - else { - lcd.setBrightness(bright); - standby =0; - lcd.clear(); - - if (units == METRIC) { - sprintf(buffer,"%0.2f Cm",avgdistance); - sprintf(buffer1,"****RANGE!****"); - sprintf(buffer2,"DISTANCE"); - - sprintf(buffer4,"Menu"); - - } else { - sprintf(buffer,"%0.2f Inches",avgdistance); - sprintf(buffer1,"****RANGE!****"); - sprintf(buffer2,"***DISTANCE***"); - sprintf(buffer4,"Menu"); - } - lcd.printString(buffer,25,2); - lcd.printString(buffer1,0,0); - lcd.printString(buffer2,16,1); - lcd.printString(buffer4,0,5); + } //close switch - float h = (r7/84); - float distbar = (avgdistance*h); + } else { //If alert isn't 0 then the distance is to be dispayed alonng with the the distance bar + lcd.setBrightness(bright); + standby = 0; + lcd.clear(); + if (units == 1) { + sprintf(buffer2,"%0.2f Cm",avgdistance); + } else { + sprintf(buffer2,"%0.2f In",avgdistance); + } + sprintf(buffer,"****RANGE!****"); + sprintf(buffer1,"DISTANCE"); + sprintf(buffer4,"Menu"); + lcd.printString(buffer2,25,2); + lcd.printString(buffer,0,0); + lcd.printString(buffer1,16,1); + lcd.printString(buffer4,0,5); + int h; + h = (84/r7*c); ///Maps length of bar to largest set range r7 + distbar = (avgdistance*h)-2; //drawRect(int x0,int y0,int width,int height,int fill); lcd.drawRect(0,29,distbar,7,1); // + serial.printf("H = %i, r7 = %i",h,r7); + serial.printf("distbar %f",distbar); lcd.refresh(); - } - } - void setalert() { - /** A fuction used to determin the alert level given a range with the use of IF statments - @param distance The distance read from sensor - @param alert The level that distance falls with in 0 -7 - @returns alert - */ - if (avgdistance >= (r6*c) && avgdistance < (r7*c)) { // r6 150 and r7 200 alert = 1; /// alert 1 avgdistance between preset 150Cm to 200Cm } else if (avgdistance >= (r5*c) && avgdistance < (r6*c)) { @@ -229,6 +214,9 @@ alert = 6; ///alert 6 when avgdistance between 1 and 20 } else if (avgdistance <=(r1*c)) { alert = 7; ///alert 7 when avgdistance below 1Cm + if (check_flag ==0) { + save(); + } check_flag = 1; } else { alert = 0; /// alert 0 all else @@ -264,7 +252,6 @@ a_led = Alertlevel[alert].sa_led; gg_led = Alertlevel[alert].sgg_led; } - } void setbuzzer() @@ -276,7 +263,7 @@ @param Alertlevel[alert].toneon controls how long the tone will last depending on alert */ buzzer.period (1.0/1000.0); - buzzer = 0.5; + buzzer = 0.2; buzzoff.attach(&flip, Alertlevel[alert].toneon); } @@ -284,7 +271,7 @@ { buzz_flag = 1; buzzer = 0.0; - buzzon.attach(&buzzflag,Alertlevel[alert].toneoff); + buzzon.attach(&buzzflag, Alertlevel[alert].toneoff); } void buzzflag() @@ -323,20 +310,15 @@ g_timer_flag_srf02 = 1; /** set flag in ISR by ticker_srf02 @param g_timer_flag_srf02 0 or 1 */ } -void timer_isr_tone() -{ - g_timer_flag_tone = 1; /** set flag in ISR by ticker_tone @param g_timer_flag_tone 0 or 1 */ -} void timer_isr_standby() { g_timer_flag_standby = 1; /** set flag in ISR by ticker_tone @param g_timer_flag_tone 0 or 1 */ } + void menu() { while(1) { - - if (g_sw1_flag) { g_sw1_flag = 0; page++; /// Moves page @@ -348,154 +330,155 @@ g_sw2_flag = 0; // if it has, clear the flag backlight(); lcd.clear(); - } else { - int lightbar = bright*84; - sprintf(buffer2,"*****MENU*****"); - sprintf(buffer1,"BACKLIGHT"); - sprintf(buffer3,"%.0f%%",bright*100); - sprintf(buffer4,"NEXT ADJ"); - lcd.printString(buffer2,0,0); - lcd.printString(buffer1,0,1); - lcd.printString(buffer3,0,2); - lcd.printString(buffer4,0,5); - lcd.drawRect(0,26,lightbar,7,1); // move bar up!!!!!!!!!!!!!!!! - lcd.refresh(); - } + int lightbar = bright*84; + sprintf(buffer1,"BACKLIGHT"); + sprintf(buffer2,"%.0f%%",bright*100); + lcd.drawRect(0,26,lightbar,7,1); // move bar up!!!!!!!!!!!!!!!! + lcd.printString(buffer1,0,1); + lcd.printString(buffer2,0,2); + sprintf(buffer4,"NEXT ADJ"); + lcd.printString(buffer4,0,5); + lcd.refresh(); break; - case 1: if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (offset == 20) { offset = 0; + lcd.clear(); } else { offset += 1; } - } else { - length2 = sprintf(buffer2,"*****MENU*****"); - length1 = sprintf(buffer1,"OFFSET"); - length3 = sprintf(buffer3,"%i",offset); - sprintf(buffer4,"NEXT ADJ"); - lcd.printString(buffer2,0,0); - lcd.printString(buffer1,0,1); - lcd.printString(buffer3,0,2); - lcd.printString(buffer4,0,5); - lcd.refresh(); } - + sprintf(buffer1,"OFFSET"); + sprintf(buffer2,"%i",offset); + lcd.printString(buffer1,0,1); + sprintf(buffer4,"NEXT ADJ"); + lcd.printString(buffer4,0,5); break; - case 2: + sprintf(buffer1,"UNITS"); + lcd.printString(buffer1,0,1); if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag - if (units == METRIC) { - units = IMPERIAL; - c= 0.3937; + if (units == 1) { + units = 0; + c = 0.3937; + sprintf(buffer2,"IMPERIAL"); + lcd.clear(); } else { - units = METRIC; + units = 1; + sprintf(buffer2,"METRIC"); c = 1; + lcd.clear(); } } - if (units == METRIC) { - sprintf(buffer3,"METRIC"); - lcd.printString(buffer3,0,2); - } else { - sprintf(buffer3,"IMPERIAL"); - lcd.printString(buffer3,0,2); - } - sprintf(buffer2,"*****MENU*****"); - sprintf(buffer1,"UNITS"); sprintf(buffer4,"NEXT ADJ"); - lcd.printString(buffer2,0,0); - lcd.printString(buffer1,0,1); lcd.printString(buffer4,0,5); - lcd.refresh(); - break; case 3: if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag check_flag =0; + lcd.clear(); } - length2 = sprintf(buffer3,"*****MENU*****"); - length3 = sprintf(buffer1,"CLEAR"); - length3 = sprintf(buffer2,"COLLISION"); - sprintf(buffer4,"NEXT YES"); - lcd.printString(buffer3,0,0); + if (check_flag == 0) { + sprintf(buffer1,"NO"); + sprintf(buffer2,"COLLISION"); + lcd.printString(buffer1,0,1); + sprintf(buffer4,"NEXT "); + } else { + sprintf(buffer1,"CLEAR"); + sprintf(buffer2,"COLLISION"); + lcd.printString(buffer1,0,1); + sprintf(buffer4,"NEXT CLEAR"); + } + + lcd.printString(buffer4,0,5); + break; + case 4: + if (g_sw2_flag) { + g_sw2_flag = 0; // if it has, clear the flag + bright = 1.0; + offset = 0; + units = 1; + r1 = 03;/// Upper limit of alert 1 + r2 = 10;/// Upper limit of alert 2 + r3 = 20;/// Upper limit of alert 3 + r4 = 35;/// Upper limit of alert 4 + r5 = 50;/// Upper limit of alert 5 + r6 = 65;/// Upper limit of alert 6 + r7 = 80;/// Upper limit of alert 7 + lcd.clear(); + sprintf(buffer1,"SETTINGS"); + sprintf(buffer2,"RESET"); + lcd.printString(buffer1,0,1); + lcd.printString(buffer2,0,2); + wait(1); + return; + } + lcd.clear(); + sprintf(buffer1,"RESET"); + sprintf(buffer2,"SETTINGS"); lcd.printString(buffer1,0,1); lcd.printString(buffer2,0,2); + sprintf(buffer4,"NEXT RESET"); lcd.printString(buffer4,0,5); - + lcd.refresh(); break; - case 4: - + case 5: if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag submenu(); } - length2 = sprintf(buffer3,"*****MENU*****"); - length3 = sprintf(buffer1,"RANGE"); - length3 = sprintf(buffer2,"PARAMETERS"); - sprintf(buffer4,"NEXT ADJ"); - lcd.printString(buffer3,0,0); + sprintf(buffer1,"RANGE"); + sprintf(buffer2,"PARAMETERS"); lcd.printString(buffer1,0,1); - lcd.printString(buffer2,0,2); + sprintf(buffer4,"EXIT ADJ"); lcd.printString(buffer4,0,5); - break; - default: lcd.clear(); - /* //save(); - - ///////////////////// Writing list to file example ////////////////////// - - // for this example, I'll create some numbers to write to file in a big list - // a data logger for example will usually append to a file - at a reading - // at the end rather than creating a new file - fp = fopen("/sd/settinngs.txt", "a"); + save (); + sprintf(buffer3," SAVING "); + lcd.printString(buffer3,0,2); + sprintf(buffer4," SETTINGS "); + lcd.printString(buffer4,0,3); + wait (1); + return; + }// switch bracket + sprintf(buffer,"*****MENU*****"); + lcd.printString(buffer2,0,2); + lcd.printString(buffer,0,0); + lcd.refresh(); + }//while braket +}//functon bracket - if (fp == NULL) { // if it can't open the file then print error message - serial.printf("Error! Unable to open file!\n"); - } else { // opened file so can write - serial.printf("Writing to file...."); - for(int i = 1; i <= 50; i++) { - int r1; - int r2; - int r3; - int r4; - int r5; - int r6; - int r7; - int offset; // create suitable variables to store the data in the file - float bright; - float dummy = 1000.0F/i; // dummy variable - fprintf(fp, "%d,%f\n",i,dummy); // print formatted string to file (CSV) - } - serial.printf("Done.\n"); - fclose(fp); // ensure you close the file after writing - } - // you can comment out the writing example to check that the writing has - // worked - when you run it after commenting, it should still open the - // file that exists on the SD card - assuming you didn't delete it! - */ - return; - } +void save() +{ + fp = fopen("/sd/settings.txt", "w"); + if (fp == NULL) { // if it can't open the file then print error message + serial.printf("Error! Unable to open file!\n"); + } else { // opened file so can write + serial.printf("Writing to file...."); + fprintf(fp, "%f,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i",bright,units,offset,check_flag,r1,r2,r3,r4,r5,r6,r7); // ensure data type matches + serial.printf("Done.\n"); + fclose(fp); // ensure you close the file after writing } } + + void submenu() { - while(1) { - /// innterupt used to shift page + /// interupt used to shift page if (g_sw1_flag) { g_sw1_flag = 0; subpage++; } - switch (subpage) { - ///interupt used to adjust range + switch (subpage) { ///interupt used to adjust range case 0: if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag @@ -505,10 +488,10 @@ r2 = r2+1; } } - length2 = sprintf(buffer1,"*****MENU*****"); - length3 = sprintf(buffer2,"RANGE"); - length3 = sprintf(buffer3,"PARAMETERS"); - length4 = sprintf(buffer4,"1Cm to %iCm",r2); + sprintf(buffer1,"*****MENU*****"); + sprintf(buffer2,"RANGE"); + sprintf(buffer3,"PARAMETERS"); + sprintf(buffer4,"1Cm to %iCm",r2); sprintf(buffer,"NEXT ADJ"); lcd.printString(buffer1,0,0); lcd.printString(buffer2,0,1); @@ -516,9 +499,7 @@ lcd.printString(buffer4,0,3); lcd.printString(buffer,0,5); break; - case 1: - if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (r3 == r4) { @@ -527,11 +508,10 @@ r3 += 1; } } - sprintf(buffer1,"*****MENU*****"); sprintf(buffer2,"RANGE"); sprintf(buffer3,"PARAMETERS"); - sprintf(buffer4,"%iCm to %iCm",r2,r3); + sprintf(buffer4,"%iCm to %iCm",r2,r3); sprintf(buffer,"NEXT ADJ"); lcd.printString(buffer1,0,0); lcd.printString(buffer2,0,1); @@ -539,9 +519,7 @@ lcd.printString(buffer4,0,3); lcd.printString(buffer,0,5); break; - case 2: - if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (r4 == r5) { @@ -550,11 +528,10 @@ r4 += 1; } } - sprintf(buffer1,"*****MENU*****"); sprintf(buffer2,"RANGE"); sprintf(buffer3,"PARAMETERS"); - sprintf(buffer4,"%iCm to %iCm",r3,r4); + sprintf(buffer4,"%iCm to %iCm",r3,r4); sprintf(buffer,"NEXT ADJ"); lcd.printString(buffer1,0,0); lcd.printString(buffer2,0,1); @@ -562,9 +539,7 @@ lcd.printString(buffer4,0,3); lcd.printString(buffer,0,5); break; - case 3: - if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (r5 == r6) { @@ -573,7 +548,6 @@ r5 += 1; } } - sprintf(buffer1,"*****MENU*****"); sprintf(buffer2,"RANGE"); sprintf(buffer3,"PARAMETERS"); @@ -586,7 +560,6 @@ lcd.printString(buffer,0,5); break; case 4: - if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (r6 == r7) { @@ -595,11 +568,10 @@ r6 += 1; } } - - length2 = sprintf(buffer1,"*****MENU*****"); - length3 = sprintf(buffer2,"RANGE"); - length3 = sprintf(buffer3,"PARAMETERS"); - length3 = sprintf(buffer4,"%iCm to %iCm",r5,r6); + sprintf(buffer1,"*****MENU*****"); + sprintf(buffer2,"RANGE"); + sprintf(buffer3,"PARAMETERS"); + sprintf(buffer4,"%iCm to %iCm",r5,r6); sprintf(buffer,"NEXT ADJ"); lcd.printString(buffer1,0,0); lcd.printString(buffer2,0,1); @@ -608,7 +580,6 @@ lcd.printString(buffer,0,5); break; case 5: - if (g_sw2_flag) { g_sw2_flag = 0; // if it has, clear the flag if (r7 == 300) { @@ -617,42 +588,37 @@ r7 += 1; } } - - length2 = sprintf(buffer1,"*****MENU*****"); - length3 = sprintf(buffer2,"RANGE"); - length3 = sprintf(buffer3,"PARAMETERS"); - sprintf(buffer,"NEXT ADJ"); - length3 = sprintf(buffer4,"%iCm to %iCm",r6,r7); + sprintf(buffer1,"*****MENU*****"); + sprintf(buffer2,"RANGE"); + sprintf(buffer3,"PARAMETERS"); + sprintf(buffer,"EXIT ADJ"); + sprintf(buffer4,"%iCm to %iCm",r6,r7); lcd.printString(buffer1,0,0); lcd.printString(buffer2,0,1); lcd.printString(buffer3,0,2); lcd.printString(buffer4,0,3); lcd.printString(buffer,0,5); break; - default: lcd.clear(); - // save(); return; - } - } -} + }//switch breaket + }//while bracket +}//function bracket + void setup() { ticker.attach(&timer_isr_led,0.35); /// Attach the ticker for the flashig LEDs - ticker_srf02.attach(&timer_isr_srf02,0.1); /// Attach the ticker for collecting a range reading - // ticker_tone.attach(&timer_isr_tone,0.1); /// Attach the ticker which controls the off time of the buzzer 0.1 = 10 beats per second - ticker_standby.attach(&timer_isr_standby,3.0); + ticker_srf02.attach(&timer_isr_srf02,0.1);/// Attach the ticker for collecting a range reading + ticker_standby.attach(&timer_isr_standby,5.0); sw1.rise(&sw1_isr); /// sw1_isr called when button presed on the rising edge sw2.rise(&sw2_isr); /// sw2_isr called when button presed on the rising edge - - - r_led = 1; - b_led = 1; - g_led = 1; - rr_led = 0; - a_led = 0; - gg_led = 0; - sw2.mode(PullDown); - sw1.mode(PullDown); + r_led = 1; //Onboard leds + b_led = 1; //Onboard leds + g_led = 1; //Onboard leds + rr_led = 0; //PCB LEDS + a_led = 0; //PCB LEDS + gg_led = 0; //PCB LEDS + sw2.mode(PullDown); //Turns on use of the pulldown resistors for use with the PCB buttons + sw1.mode(PullDown); //Turns on use of the pulldown resistors for use with the PCB buttons } \ No newline at end of file