1.11M Members

Help for the Wire less Water Level Indicator for Programming the ARDUINO 32

 
0
 

i have put one FUNCTION (Display) in the code's
but still not functional

is there any way by which we can convert BCD to DEC code's and can be printed out as output

I know its wrong please help me to make it right
thanks
[ the CODE's is for 'C' not for 'ARDUINO' ]

#include<stdio.h>
#include<conio.h>
void display(int z)
int main(void)
{
     int a,b,c,d;
     int x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
     x0=00;
     x1=10;
     x2=20;
     x3=25;
     x4=30;
     x5=40;
     x6=50;
     x7=60;
     x8=70;
     x9=75;
     x10=80;
     x11=90;
     x12=100;
     x13=0;
     x14=0;
     x15=0;
     printf("Enter the Val of A,B,C,D\n");
     scanf("%d,%d,%d,%d",&a,&b,&c,&d);
     printf("Val of a,b,c,d,%d,%d,%d,%d",a,b,c,d);
     display(int z)
     getch();
     }


{

    void display(int z)

{
    if(a==0&&b==0&&c==0&&d==0)
    printf("%a,%b,%c,%d is 00% EMPTY",x0);//0000=00
    }
{
    if(a==0&&b==0&&c==0&&d==1)
    printf("%a,%b,%c,%d is 10%",x1);//0001=01
    }
{
    if(a==0&&b==0&&c==1&&d==0)
    printf("%a,%b,%c,%d is 20%",x2);//0010=02
    }
{
    if(a==0&&b==0&&c==1&&d==1)
    printf("%a,%b,%c,%d is 25%",x3);//0011=03
    }
{
    if(a==0&&b==1&&c==0&&d==0)
    printf("%a,%b,%c,%d is 30%",x4);//0100=04
    }
{
    if(a==0&&b==1&&c==0&&d==1)
    printf("%a,%b,%c,%d is 40%".x5);//0101=05
    }
{
    if(a==0&&b==1&&c==1&&d==0)
    printf("%a,%b,%c,%d is 50%",x6 HALF);//0110=06
    }
{
    if(a==0&&b==1&&c==1&&d==1)
    printf("%a,%b,%c,%d is 60%",x7);//0111=07
    }
{
    if(a==1&&b==0&&c==0&&d==0)
    printf("%a,%b,%c,%d is 70%",x8);//1000=08
    }
{
    if(a==1&&b==0&&c==0&&d==1)
    printf("%a,%b,%c,%d is 75%",x9);//1001=09
    }
{
    if(a==1&&b==0&&c==1&&d==0)
    printf("%a,%b,%c,%d is 80%",x10);//1010=10
    }
{
    if(a==1&&b==0&&c==1&&d==1)
    printf("%a,%b,%c,%d is 90%",x11);//1011=11
    }
{
    if(a==1&&b==1&&c==0&&d==0)
    printf("%a,%b,%c,%d is 100% FULL",x12);//1100=12
    }
{
    if(a==1&&b==1&&c==0&&d==1)
    printf("%a,%b,%c,%d is 100% ALARM",x13);//1101=13
    }
{
    if(a==1&&b==1&&c==1&&d==0)
    printf("%a,%b,%c,%d is xXx",x14 );//1110=14
    }
{
    else(a==1&&b==1&&c==1&&d==1)
    printf("%a,%b,%c,%d is XxX",x15);//1111=15
    }

}
 
0
 

you haven't declared int z + hasn't assigned anything to it ;)

Better you take user input in the function display() and in prototype set its parameters as void.

All your "if" Blocks are wrong, check your parantheses.

better use if, elseif, else

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article