Pages: [1]   Go Down
Author Topic: How do I montior input values on the Arduino?  (Read 280 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there some way using the Arduino software or other software that I can print out the values of my inputs and outputs in real time?

What I'm trying to do is use an LED as a light detector to trigger another LED.  Very simple proof of concept.  I'm reading in the voltage of the 1st led and when it reaches a threshold value, it should trigger the other led.

I'm using an Arduino Duemilanove.

Code:
int ledout = 2;
int ledin = 0;
int voltage = 0;

void setup()
{
  pinMode(ledout, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  voltage = analogRead(ledin);
  Serial.print(voltage);
  digitalWrite(ledout, HIGH);
  
  if (voltage > 0.50)
  {
    digitalWrite(ledout, LOW);
  }
  else
  {
  }
}

The code works, it does what I want, I just wanted to have the ability to monitor the voltage going into the Arduino from the detector LED.
Logged

Austin, TX USA
Offline Offline
God Member
*****
Karma: 4
Posts: 997
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Citizen--

With the line "Serial.print(voltage)" you are already repeatedly sending the value of "voltage" to the Serial monitor.  In the Arduino IDE, if you just push the "Serial Montior" button (upper right) you should see a stream of values.

Mikal
Logged

Pages: [1]   Go Up
Jump to: