#include "suryaa.h"
void setup()
{
  pin_configure();
  Serial.begin(9600);
}
void loop()
{
  //Serial.println("hi");
  volatile long a=0,b=0,c=0,d=0,e=0,f=0;
  volatile long k;
  volatile long static y;
  a=digit_press5();
  for(k=0;k<100000;k++);
  Serial.println("the value of a is:");
  Serial.println(a);
  b=digit_press4();
  for(k=0;k<100000;k++);
    Serial.println("the value of b is:");
  Serial.println(b);
    c=a-b;
      Serial.println("the value ofc sum is:");
  Serial.println(c);
    if(c>9999)
    {
      output3(0x79);
      output5(0x79);
      output4(0x79);
      output2(0x79);
      for(k=0;k<20000000;k++);
      output3(0x00);
      output5(0x00);
      output4(0x00);
      output2(0x00);
    }
    else
      {
        if(c<0)
        {
          e=abs(c);
          Serial.println("the coverted  +ve number is:");
        Serial.println(e);
          for(k=0;k<100000;k++);
        d=count_digit(e);
        Serial.println("the vlue of the -ve count is:");
        Serial.println(d);
        if(d==0)
         {
          for(k=0;k<100000;k++)
         output2(0x3f);
         for(k=0;k<100000;k++)
         output2(0x00);
         }
         else
         {

        if(d==1)
        {
          count_digit1_display1(e);
        }
        else if(d==2)
        {
          count_digit1_display2(e);
        }
        else if(d==3)
        {
          count_digit1_display3(e);
        }
        else if(d==4)
        {
          output3(0x79);
          output5(0x79);
          output4(0x79);
          output2(0x79);
          for(k=0;k<2000000;k++);
          output3(0x00);
          output5(0x00);
          output4(0x00);
          output2(0x00);
        }
        }
        }
        
        
      else
      {
        f=count_digit(c);
        for(k=0;k<100000;k++);
         Serial.println("the vlue of the +ve count is:");
         Serial.println(d);
         if(f==0)
         {
         for(k=0;k<100000;k++);
         output2(0x3f);
         for(k=0;k<100000;k++)
         output2(0x00);
         }
         else
         {
       if(f==1)
        {
          count_digit_display1(c);
        }
        else if(f==2)
        {
          count_digit_display2(c);
        }
        else if(f==3)
        {
          count_digit_display3(c);
        }
        else if(f==4)
        {
          count_digit_display4(c);
        }
        }
      }
      }
  }







/*#include "suryaa.h"
void setup()
{
  pin_configure();
  Serial.begin(9600);
}
void loop()
{
  Serial.println("hi");
  volatile long a=0,b=0,c=0,d=0;
  volatile long k;
  volatile long static y;
  a=digit_press3();
  for(k=0;k<100000;k++);
  Serial.println("the value of a is:");
  Serial.println(a);
  b=digit_press4();
  for(k=0;k<100000;k++);
    Serial.println("the value of b is:");
  Serial.println(b);
    c=a+b;
      Serial.println("the value ofc sum is:");
  Serial.println(c);
    if(c>9999)
    {
      output3(0x79);
      output5(0x79);
      output4(0x79);
      output2(0x79);
      for(k=0;k<20000000;k++);
      output3(0x00);
      output5(0x00);
      output4(0x00);
      output2(0x00);
    }
    else
      {
        d=count_digit(c);
        Serial.println("the vlue of the count is:");
        Serial.println(d);
        if(d==1)
        {
          count_digit_display1(c);
        }
        else if(d==2)
        {
          count_digit_display2(c);
        }
        else if(d==3)
        {
          count_digit_display3(c);
        }
        else if(d==4)
        {
          count_digit_display4(c);
        }
      }
  }
*/




















































/*#include "suryaa.h"
void setup()
{
  pin_configure();
  Serial.begin(9600);
}
void loop()
{
  Serial.println("hi");
  volatile long a=0,b=0,c=0,d=0;
  volatile long k;
  volatile long static y;
  a=digit_press3();
  for(k=0;k<100000;k++);
  Serial.println("the value of a is:");
  Serial.println(a);
  b=digit_press4();
  for(k=0;k<100000;k++);
    Serial.println("the value of b is:");
  Serial.println(b);
    c=a+b;
      Serial.println("the value ofc sum is:");
  Serial.println(c);
    if(c>9999)
    {
      output3(0x79);
      output5(0x79);
      output4(0x79);
      output2(0x79);
      for(k=0;k<20000000;k++);
      output3(0x00);
      output5(0x00);
      output4(0x00);
      output2(0x00);
    }
    else
      {
        d=count_digit(c);
        Serial.println("the vlue of the count is:");
        Serial.println(d);
        if(d==1)
        {
          count_digit_display1(c);
        }
        else if(d==2)
        {
          count_digit_display2(c);
        }
        else if(d==3)
        {
          count_digit_display3(c);
        }
        else if(d==4)
        {
          count_digit_display4(c);
        }
      }
  }*/
mega:SCL
mega:SDA
mega:AREF
mega:GND.1
mega:13
mega:12
mega:11
mega:10
mega:9
mega:8
mega:7
mega:6
mega:5
mega:4
mega:3
mega:2
mega:1
mega:0
mega:14
mega:15
mega:16
mega:17
mega:18
mega:19
mega:20
mega:21
mega:5V.1
mega:5V.2
mega:22
mega:23
mega:24
mega:25
mega:26
mega:27
mega:28
mega:29
mega:30
mega:31
mega:32
mega:33
mega:34
mega:35
mega:36
mega:37
mega:38
mega:39
mega:40
mega:41
mega:42
mega:43
mega:44
mega:45
mega:46
mega:47
mega:48
mega:49
mega:50
mega:51
mega:52
mega:53
mega:GND.4
mega:GND.5
mega:IOREF
mega:RESET
mega:3.3V
mega:5V
mega:GND.2
mega:GND.3
mega:VIN
mega:A0
mega:A1
mega:A2
mega:A3
mega:A4
mega:A5
mega:A6
mega:A7
mega:A8
mega:A9
mega:A10
mega:A11
mega:A12
mega:A13
mega:A14
mega:A15
sevseg1:COM.1
sevseg1:COM.2
sevseg1:A
sevseg1:B
sevseg1:C
sevseg1:D
sevseg1:E
sevseg1:F
sevseg1:G
sevseg1:DP
keypad1:R1
keypad1:R2
keypad1:R3
keypad1:R4
keypad1:C1
keypad1:C2
keypad1:C3
keypad1:C4
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
r4:1
r4:2
sevseg2:COM.1
sevseg2:COM.2
sevseg2:A
sevseg2:B
sevseg2:C
sevseg2:D
sevseg2:E
sevseg2:F
sevseg2:G
sevseg2:DP
sevseg3:COM.1
sevseg3:COM.2
sevseg3:A
sevseg3:B
sevseg3:C
sevseg3:D
sevseg3:E
sevseg3:F
sevseg3:G
sevseg3:DP
sevseg4:COM.1
sevseg4:COM.2
sevseg4:A
sevseg4:B
sevseg4:C
sevseg4:D
sevseg4:E
sevseg4:F
sevseg4:G
sevseg4:DP