Pages: 1 [2]   Go Down
Author Topic: Id Appreciate Some Advise Mates  (Read 1981 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

can someone tell me if i can graph a value taken from digital pins just using Arduino software??I have and external circuit connected to arduino that consists of a thermometer and an 8 bit adc.I attached the adc outputs to arduino digital pins 2-9 and can see i'm reading the digital inputs normally in monitoring.Now i'm trying to figure out how to graph the changes in temperature along with time.So i guess all i have to do is create two axis x for time and y for the value(for example a table 400*500) and address the points on the graph by combining the x dimension(time) with y dimension(value) in a float table[x,y].....When the time reaches  the right end it should go to the beggining and continue.What i'd expect to see as an outcome is a line going up and down until the right end of the interface,then instantly vanishing and starting from the beggining.I hope there is simple way to do this with arduino 1.01...if not somebody will probably advise me to use processing!!   heres what i've done so far in arduino 1,01


void setup() {
  // initialize serial:
  Serial.begin(9600);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
 
}
  void loop() {
 
  int a = digitalRead(2);
  int b = digitalRead(3);
  int c = digitalRead(4);
  int d = digitalRead(5);
  int e = digitalRead(6);
  int f = digitalRead(7);
  int g = digitalRead(smiley-cool;
  int h = digitalRead(9);
 
int val=(a * 1 ) + (b * 2 ) + (c * 4 ) + (d * 8 ) + (e * 16 ) + (f * 32 ) + (g * 64 ) + (h * 128 );
  Serial.print("Read switches  : ");
  Serial.println(val);
  delay(1000);
  }
Logged

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

Quote
I hope there is simple way to do this with arduino 1.01...if not somebody will probably advise me to use processing!!
I advise you use Processing.
The IDE has no graphical capabilities, beyond ASCII art.

I also advise you post code between code tags
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does using processing mean i cant use the code i ve written so far?
Logged

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

Unless you've got a graphical LCD or display device attached to your Arduino, you've got no way of displayng your data.
So, you probably need to display the data on your PC, and yes, Processing is one of the options available to you.

If you go back to the post wth the code in n, click on "modify", highlight the code, then click on the # icon on the toolbar, you'll improve the legibility of your code.
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My friend Awol  i dont need anything fancy and 'grafical'
just a real time 2-dimensional point creation.It could be dots or a line...
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


In processing you can use   setpix(X, Y, color) - processing can be downloaded from  www.processing.org
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

Quote
My friend Awol i dont need anything fancy and 'grafical' just a real time 2-dimensional point creation.It could be dots or a line...
I'd love to hear your definition of graphical.

Still not too late to go back and make that code legible with CODE TAGS
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmmm ok i'd say grafical is way of designing motion or motionless images that gives the observer an artistic sense of hamony!!
After alot of research i still can't surely say tha a graph of a value can't be constructed using arduino.Probably someone can only make a one-dimensional graph to show the value on that simle text -like interface arduino has.But i'm still trying to think of a way to do this before using processing for something more complete.Heres the code with tags:

Code:
void setup() {
  // initialize serial: start serial communication at 9600kb/s
  Serial.begin(9600);
pinMode(2, INPUT);//attach each one of the 8 adc outputs to a digital pin on the arduino
pinMode(3, INPUT);//  and assign digital pins as inputs(pins 1 and 0 are used for other purpose)
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
 
}
  void loop() {
 
  int a = digitalRead(2);//read each pins output and to use it as an input later store it in a variable at the same time
  int b = digitalRead(3);//the variables are int because digital pins give an output 0(0 volts from adc) or 1(5 volts from adc)
  int c = digitalRead(4);
  int d = digitalRead(5);
  int e = digitalRead(6);
  int f = digitalRead(7);
  int g = digitalRead(8);
  int h = digitalRead(9);
 
int val=(a * 1 ) + (b * 2 ) + (c * 4 ) + (d * 8 ) + (e * 16 ) + (f * 32 ) + (g * 64 ) + (h * 128 );//estimate the total outcome of my 8 bit adc
val=((val*19.6)/3.13)/10;//estimate the right temperature
  Serial.print("Read switches  : ");//print the text
  Serial.println(val);//print the value
  delay(1000);wait 1sec before you repeat the loop
  }

Moderator edit: [code] [/code] tags added.
« Last Edit: May 28, 2012, 03:16:49 am by AWOL » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Somebody please tell me what command to use in arduino in order to clear the monitoring screen.Is it possible to clear it without actually closing the interface??????????????????????????????  smiley-eek-blue
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you mean the Serial Monitor, then there is no way to clear the screen. If you need to do that, you'll need an alternative terminal application that supports command sequences. I believe PuTTY supports a few, including VT100 and ESC[n.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4771
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why hook up an 8-bit ADC when you could just use the 10-bit ADC in the chip and map the output to 0-255?

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is because this project is a continuation of my first one,that consists of an lm35(thermometer) an lm741(connected as an non-converting operational amplifier) and an adc0804.....
Logged

Pages: 1 [2]   Go Up
Jump to: