Pages: 1 [2] 3 4   Go Down
Author Topic: help for the program for water tank  (Read 3946 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26484
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50166
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pl any help
Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

California
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3434
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

pl any help

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

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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:
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:
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:
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:
[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
Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26484
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you please clean up that last post?
Logged

"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.

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
There's a library for driving the LCD, with examples.


where to find that LIBRARY for the LCD
Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26484
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
    }
 */
Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26484
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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"
Logged

"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.

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
#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();
     }

Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Mumbai -INDIA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

"THE LIFE IS VERY SMALL TO LEARN ELECTRONICS"
                           ε∫εζτ√°ηiζ≈
                           AND
                           yes
                           PROGRAMMING

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26484
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

See reply #24
Logged

"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.

Pages: 1 [2] 3 4   Go Up
Jump to: