Go Down

Topic: help for the program for water tank (Read 4373 times) previous topic - next topic

AWOL

Quote
I can Switch ON and OFF the one LED

So, you can read several pins and set or reset bits (instead of lighting an LED) in a variable based on the values read from the pins.
There's a library for driving the LCD, with examples.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

PaulS

Quote
I just wanted to know how to write code for the ARDUINO 328

You have some, so presumably your not as dumb as you are pretending to be.

Quote
which have 4 pins input A,B,C,D as (0000 to 1111) on Arduino pin no 3,4,5 & 6

You already know how to read one pin. Read three more EXACTLY the same way.

Quote
and the output to be displayed on the LCD as desired.

The LCD can't display binary data, so, no it won't.

YOU need to convert the value YOU form from the 4 pins into text/graphics/etc.

mkbutan

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

Arrch


pl any help


Aside from writing the code for you, what other help are you looking for?

mkbutan



Quote
which have 4 pins input A,B,C,D as (0000 to 1111) on Arduino pin no 3,4,5 & 6

You already know how to read one pin. Read three more EXACTLY the same way.

Code: [Select]

the input are commented (//....)
const int buttonPin = 3;     // the pushbutton pin A
//const int buttonPin = 4;     // the pushbutton pin B
//const int buttonPin = 5;     // the pushbutton pin C
//const int buttonPin = 6;     // the pushbutton pin D
const int ledPin =  12;      // the LED pin



Code: [Select]
const int buttonPin = 3;     // the pushbutton pin A
const int buttonPin = 4;     // the pushbutton pin B
const int buttonPin = 5;     // the pushbutton pin C
const int buttonPin = 6;     // the pushbutton pin D
const int ledPin =  12;      // the LED pin


but i dont get the output on the pin#12 with this

Quote
and the output to be displayed on the LCD as desired.

The LCD can't display binary data, so, no it won't.

YOU need to convert the value YOU form from the 4 pins into text/graphics/etc.


that's my Question was how to do that?
pl explain

Posted on: December 19, 2012, 07:28:35 PMPosted by: AWOL
Code: [Select]
I can Switch ON and OFF the one LED
So, you can read several pins and set or reset bits (instead of lighting an LED) in a variable based on the values read from the pins.
Code: [Select]
[u][b]There's a library for driving the LCD, with examples[/b][/u].

pl guide me where????
and how to use it in my program
"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

AWOL

Could you please clean up that last post?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mkbutan


Quote
I can Switch ON and OFF the one LED

So, you can read several pins and set or reset bits (instead of lighting an LED) in a variable based on the values read from the pins.

Code: [Select]
There's a library for driving the LCD, with examples.



where to find that LIBRARY for the LCD
"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

AWOL

Quote
where to find that LIBRARY for the LCD

I'd look in the IDE, or over at the Main Site, or the Playground.
But I'd certainly look around.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mkbutan

pl let me know how to make it work?


#include<stdio.h>
#include<conio.h>
void main()
{
     int a,b,c,d;
     printf("Enter the Val of A,B,C,D");
     scanf ("%d,%d,%d,%d",&a,&b,&c,&d);
     printf("Val of a,b,c,d",%d,%d,%d,%d);
     getch();
     }

????????
????????
????????

/*
int
{
    if(a=0&&b=0&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "00%" EMPTY);//0000=00
    }
    {
    if(a=0&&b=0&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "10%" );//0001=01
    }
    {
    if(a=0&&b=0&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "20%" );//0010=02
    }
    {
    if(a=0&&b=0&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "25%" );//0011=03
    }
    {
    if(a=0&&b=1&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "30%" );//0100=04
    }
    {
    if(a=0&&b=1&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "40%" );//0101=05
    }
    {
    if(a=0&&b=1&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "50%" );//0110=06
    }
    {
    if(a=0&&b=1&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "60%" );//0111=07
    }
    {
    if(a=1&&b=0&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "70%" );//1000=08
    }
    {
    if(a=1&&b=0&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "75%" );//1001=09
    }
    {
    if(a=1&&b=0&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "80%" );//1010=10
    }
    {
    if(a=1&&b=0&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "90%" );//1011=11
    }
    {
    if(a=1&&b=1&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "100%" FULL);//1100=12
    }
    {
    if(a=1&&b=1&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "100" Alarm);//1101=13
    }
    {
    if(a=1&&b=1&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "xxx%" );//1110=14
    }
    {
    if(a=1&&b=1&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "xxx%" );//1111=15
    }
*/
"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

AWOL

Code: [Select]
if(a=0&&b=0&&c=0&&d=0)
I know it is in a comment, and you didn't post it between CODE TAGS, but those are assignments, and will ALWAYS be false.

Good luck with "printf"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mkbutan

sir is this code correct ?
or what I am doing wrong. 

Code: [Select]
#include<stdio.h>
#include<conio.h>
void main()
{
     int a,b,c,d;
     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");
     getch();
     }


"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

ash901226

the problem is you are programming in c not in arduino style.

PeterH


sir is this code correct ?
or what I am doing wrong. 


You are calling scanf(), which reads from the current process's stdin stream, although the stdin stream is not defined in the Arduino runtime.

You need to either figure out how to configure the AVR runtime environment so that stdin is connected with your incoming serial stream, or replace that with code to read a string from the serial port and parse it into your expected sequence of integers (for example, using sscanf()). I think you will find the second option substantially easier since that is how almost everyone else does it so there is no shortage of working examples.
I only provide help via the forum - please do not contact me for private consultancy.

mkbutan

Thank's
yes you are right
there code's are written in 'C' for DEV C++ and not for the ARDUINO
I just wanted to test the code for its working
but its not working
my concept is same  (4 Input - 16 Output's)
in my previous post I tried to do so with if if if .... else statement( which are /*  COMMENTED */)
any help?
"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ??????°?i??
                           AND
                           yes
                           PROGRAMMING

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up