|
|
@@ -15,7 +15,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- lcd.setCursor(0,2);
|
|
|
+ lcd.setCursor(9,0);
|
|
|
|
|
|
|
|
|
lcd.print(round(angle));
|
|
|
@@ -27,19 +27,135 @@
|
|
|
// SPFT(Z);
|
|
|
// SP(z);
|
|
|
|
|
|
- // Characters
|
|
|
- byte compass__empty[8] = {B00100, B01000, B00100, B00010, B00100, B01000, B00100, B01000};
|
|
|
- byte compass__left_marker[8] = {B00001, B00001, B00001, B00001, B00001, B01111, B10001, B01110};
|
|
|
- byte compass__marker[8] = {B00001, B00001, B00001, B00001, B00001, B01111, B11111, B01110};
|
|
|
- byte compass__right_marker[8] = { B01110, B01001, B00101, B00010, B00001, B01111, B11111, B01110};
|
|
|
|
|
|
+ //draw bargraf
|
|
|
+ //i * x = 360 ==22
|
|
|
+ //0--8 >180 <0 ..
|
|
|
+ for(int i = 0 ; i <=16 ; i++ ) {
|
|
|
+ if(angle > 180) {
|
|
|
+
|
|
|
+ } else {
|
|
|
+ }
|
|
|
|
|
|
- lcd.createChar(0, compass__empty);
|
|
|
- lcd.createChar(1, compass__left_marker);
|
|
|
- lcd.createChar(2, compass__marker);
|
|
|
- lcd.createChar(3, compass__right_marker);
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ lcd.createChar(0, compass__N);
|
|
|
+ lcd.createChar(1, compass__E);
|
|
|
+ lcd.createChar(2, compass__S);
|
|
|
+ lcd.createChar(3, compass__W);
|
|
|
+ lcd.createChar(4, compass__N);
|
|
|
+ //WRITE PART OF compass__bearing
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ byte compass__bearing__part[8];
|
|
|
+ for(int p = 0; p<8; p++) {
|
|
|
+ compass__bearing__part[p] = B00000;
|
|
|
+ }
|
|
|
+ int context_digit = 0 ; //4
|
|
|
+ int context_row = 0 ; //5
|
|
|
+ int context_digit_real = 0 ; //5
|
|
|
+ int context_digit_row_real = 0 ; //5
|
|
|
+
|
|
|
+ bool context_is_printing = false;
|
|
|
+ for(int degree = 0; context_digit_real < 4; degree ++ ) {
|
|
|
+ if(context_row == 5) {
|
|
|
+ context_row = 0 ;
|
|
|
+ context_digit ++ ;
|
|
|
+ }
|
|
|
+ if(context_digit == 4) {
|
|
|
+ context_digit = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(degree == 360) {
|
|
|
+ degree = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(context_digit_row_real == 5) {
|
|
|
+ lcd.createChar(context_digit_real, compass__bearing__part);
|
|
|
+ for(int p = 0; p<8; p++) {
|
|
|
+ compass__bearing__part[p] = B00000;
|
|
|
+ }
|
|
|
+ context_digit_row_real = 0;
|
|
|
+ context_digit_real ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(angle == degree) {
|
|
|
+ context_is_printing = true ;
|
|
|
+ // lcd.createChar(0, display__char_A[2].character);
|
|
|
+ // lcd.write(byte(0));
|
|
|
+ Serial.print("Cd[");Serial.print(context_digit);Serial.print("] r[");Serial.print(context_row) ; Serial.print("]");
|
|
|
+ }
|
|
|
+ if(context_is_printing == true) {
|
|
|
+ for(int p = 0; p<8; p++) {
|
|
|
+ byte row ;
|
|
|
+ int shift = B00001;
|
|
|
+ shift = shift << ( 4 - context_row ) ;
|
|
|
+ //bitWrite(row,1,1);
|
|
|
+ byte input = display__char_A[context_digit].character[p] & shift;
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | input ; // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ /*if(context_row == 0 ) {
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | ( display__char_A[context_digit].character[p] & B10000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ } else if(context_row == 1 ) {
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | ( display__char_A[context_digit].character[p] & B01000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ } else if(context_row == 2 ) {
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | ( display__char_A[context_digit].character[p] & B00100 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ } else if(context_row == 3 ) {
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | ( display__char_A[context_digit].character[p] & B00010 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ } else if(context_row == 4 ) {
|
|
|
+ compass__bearing__part[p] = compass__bearing__part[p] | ( display__char_A[context_digit].character[p] & B00001 );// B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ } */
|
|
|
+ }
|
|
|
+ context_digit_row_real ++;
|
|
|
+
|
|
|
+ }
|
|
|
+ context_row ++;
|
|
|
+ // context_digit ++ ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for(int p = 0; p<8; p++) {
|
|
|
+ compass__bearing__part[p] = B00000;
|
|
|
+ }
|
|
|
+ compass__bearing__part[0] = compass__bearing__part[0] | ( display__char_A[2].character[0] & B00001 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[0] = compass__bearing__part[0] | ( display__char_A[2].character[0] & B00010 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[0] = compass__bearing__part[0] | ( display__char_A[2].character[0] & B00100 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[0] = compass__bearing__part[0] | ( display__char_A[2].character[0] & B01000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[0] = compass__bearing__part[0] | ( display__char_A[2].character[0] & B10000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+
|
|
|
+ compass__bearing__part[1] = compass__bearing__part[1] | ( display__char_A[2].character[1] & B00001 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[1] = compass__bearing__part[1] | ( display__char_A[2].character[1] & B00010 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[1] = compass__bearing__part[1] | ( display__char_A[2].character[1] & B00100 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[1] = compass__bearing__part[1] | ( display__char_A[2].character[1] & B01000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[1] = compass__bearing__part[1] | ( display__char_A[2].character[1] & B10000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+
|
|
|
+ compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B00001 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B00010 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B00100 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B01000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B10000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+
|
|
|
+ compass__bearing__part[3] = compass__bearing__part[3] | ( display__char_A[2].character[3] & B00001 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[3] = compass__bearing__part[3] | ( display__char_A[2].character[3] & B00010 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ compass__bearing__part[3] = compass__bearing__part[3] | ( display__char_A[2].character[3] & B00100 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B01000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+ // compass__bearing__part[2] = compass__bearing__part[2] | ( display__char_A[2].character[2] & B10000 ); // B11111 ; //compass__bearing[p] & B00001 ;
|
|
|
+
|
|
|
+
|
|
|
+ lcd.createChar(4, compass__bearing__part);
|
|
|
+ // lcd.createChar(4, compass__N);
|
|
|
+ lcd.setCursor(13,0);
|
|
|
+
|
|
|
+ lcd.write(byte(0));
|
|
|
+ lcd.write(byte(1));
|
|
|
+ lcd.write(byte(2));
|
|
|
+ lcd.write(byte(3));
|
|
|
+
|
|
|
+ lcd.write(byte(4));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- lcd.write(byte(0));
|
|
|
- lcd.write(byte(0));
|
|
|
-delay(1000);
|
|
|
+delay(110);
|