This class encapsulates all the algorithms required for the displaying strings and time dependent patterns on the lcd.
Dependents: 200943412_QuickClick
Diff: Display.cpp
- Revision:
- 15:c14c72342de7
- Parent:
- 13:505b4fb28caf
- Child:
- 16:8d158d39d438
--- a/Display.cpp Sun Apr 23 16:36:26 2017 +0000 +++ b/Display.cpp Mon Apr 24 09:46:56 2017 +0000 @@ -35,17 +35,17 @@ void Display::drawCircle(Controller &pad, N5110 &lcd) { Circle(pad, lcd); - printf("Prev Wait:- %3.2f\n",_w); + //printf("Prev Wait:- %3.2f\n",_w); calculateWait(); _h++; - printf("Score:- %d\n",_h); + //printf("Score:- %d\n",_h); lcd.clear(); lcd.refresh(); } void Display::calculateWait() { - _w = 0.2*exp(-0.0231*_h); + _w = 0.2*exp(-0.0231*_h); //this equation models how much time the user has to complete action with larger amounts of iterations. } @@ -62,7 +62,7 @@ } -void Display::display_instruction(N5110 &lcd, int ran) { +void Display::display_instruction(N5110 &lcd, int ran) { //printing a random instruction on the screen lcd.clear(); if (ran == 1){ lcd.printString("PRESS",28,2); @@ -85,7 +85,7 @@ else { lcd.printString("PRESS",28,2); lcd.printString("STICK",28,3); } - printf("Random Instruction int:- %d\n", ran); + //printf("Random Instruction int:- %d\n", ran); lcd.refresh(); } @@ -94,15 +94,15 @@ { for (int a = 0; a < 8; ++a) { - printf("for loop (a):- %d\n",a); + //printf("for loop (a):- %d\n",a); Drawarc(lcd, a); lcd.refresh(); - float Brightness = ctrl.pot_value(); + float Brightness = ctrl.pot_value(); //set brightness to petentiometer value lcd.setBrightness(0.0); - printf("Brightness:- %3.2f\n",Brightness); - printf("Wait used:- %3.2f\n",_w); + //printf("Brightness:- %3.2f\n",Brightness); + //printf("Wait used:- %3.2f\n",_w); wait(_w); - lcd.setBrightness(Brightness); + lcd.setBrightness(Brightness); //Variable brightness will change with petentiometer value wait(_w); } @@ -118,11 +118,11 @@ x0 = 42; y0 = 24; - while(x >= y) { //incorporating printf in this loop will considerably slow down my microcontroller as it has so many iterations per second. + while(x >= y) { switch(a) { - case 0 : {a1 = y; + case 0 : {a1 = y; //each case statement draws an arc by setting a1 and b1 accordingly b1 = x * -1; break; } @@ -161,10 +161,10 @@ } - lcd.setPixel( a1 + x0, b1 + y0); + lcd.setPixel( a1 + x0, b1 + y0); //draws octant depending on a1 and b1 - y++; - + y++; + if (radiusMod<0) { radiusMod += 2*y+1; @@ -172,6 +172,10 @@ x--; radiusMod += 2*(y-x)+1; } - + //printf("a1:- %d\n", a1); + //printf("b1:- %d\n", b1); + //printf("x:- %d\n", x); + //printf("y:- %d\n", y); + //printf("radiusMod:- %d\n",radiusMod); } -} \ No newline at end of file +}