Go Down

Topic: How do I montior input values on the Arduino? (Read 316 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
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview