Go Down

Topic: How do I montior input values on the Arduino? (Read 323 times) previous topic - next topic

Citizen_Insane

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: [Select]

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.

mikalhart

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

Go Up