Project
Dependencies: 4DGL-uLCD-SE MAX31855 mbed-rtos mbed
Revision 4:85eb29963721, committed 2014-11-19
- Comitter:
- ericspatterson
- Date:
- Wed Nov 19 15:19:54 2014 +0000
- Parent:
- 3:0f0e79eff4a7
- Commit message:
- updated controls...still needs more user control
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Nov 13 01:24:09 2014 +0000 +++ b/main.cpp Wed Nov 19 15:19:54 2014 +0000 @@ -8,7 +8,8 @@ DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); -DigitalOut led4(LED4); +DigitalOut led4(LED4); +DigitalOut motor(p22); // motor control uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin; SPI thermoSPI(p5,p6,p7); // setup SPI interface @@ -19,12 +20,14 @@ DigitalIn up(p19); // User pushbutton up controller DigitalIn down(p18); // User pushbutton down button controller + int settemp = 85; // initial temperature set float ftemperature = 0; // float variable for temperature float ctemperature = 0; // float variable for temperature int key_code=0; + // Create the interrupt receiver object on pin 26 InterruptIn interrupt(p26); @@ -93,10 +96,6 @@ for (i=0; i<12; i++) { if (((value>>i)&0x01)==1) key_code=i+1; } - led4=key_code & 0x01; - led3=(key_code>>1) & 0x01; - led2=(key_code>>2) & 0x01; - led1=(key_code>>3) & 0x01; } @@ -121,7 +120,7 @@ uLCD.printf("%2d", key_code); four_slots.release(); - if (key_code == 2){ + if(key_code == 2){ settemp += 1; four_slots.wait(); uLCD.color(0xFFFF00); @@ -129,10 +128,10 @@ uLCD.printf("Set Temp. F"); uLCD.locate(0,6); //col,row uLCD.printf("%d",settemp); - four_slots.release(); - //wait(.5); + four_slots.release(); + wait(2); } - if (key_code== 1){ + if(key_code== 1){ settemp -= 1; four_slots.wait(); uLCD.color(0xFFFF00); @@ -141,7 +140,25 @@ uLCD.locate(0,6); //col,row uLCD.printf("%d",settemp); four_slots.release(); - //wait(.5); + } + + if(key_code== 9){ + motor = 0; + settemp -= 1; + four_slots.wait(); + uLCD.color(0xFFFF00); + uLCD.locate(0,13); //col,row + uLCD.printf("Motor is OFF"); + four_slots.release(); + } + if(key_code== 10){ + motor = 1; + settemp -= 1; + four_slots.wait(); + uLCD.color(0xFFFF00); + uLCD.locate(0,13); //col,row + uLCD.printf("Motor is ON "); + four_slots.release(); } if(ftemperature < settemp-1){ //condition for 1 degree under