Arduino Forum

Products => The Arduino Starter Kit and Basic Kit => Topic started by: 00woodm on Jan 09, 2016, 08:20 pm

Title: No Information in serial monitor
Post by: 00woodm on Jan 09, 2016, 08:20 pm

Forgive me for this no doubt stupid question but;

After inputting the code from the projects book, I cannot see anything in the serial monitor. Obviously I have checked the baut rate is at the required 9600, and for anyone's info my Arduino is in COM3.

Naturally the lights are not working. So I guess the question is;

Is the problem with the code, causing the serial monitor to not work? or vice versa.

The code compiles fine with no errors;

Here is my code, which I believe is straight out of the book..

const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup(){
  Serial.begin(9600);//open a serial port
  for(int pinNumber = 2; pinNumber,5; pinNumber ++){
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
void loop(){
  int sensorVal = analogRead(sensorPin);
  Serial.print("sensor value:");
  //convert the ADC reading to voltage
  float voltage = (sensorVal/1024.0)*5.0;
  Serial.print(", Volts: ");
  Serial.print(", degrees C: ");
  //convert the voltageto temperature in degrees
  float temperature = (voltage - .5)*100;

  else if(temperature>=baselineTemp+2 && temperature<baselineTemp+4){
  } else if(temperature>=baselineTemp+4&& temperature<baselineTemp+6){
  } else if(temperature>=baselineTemp+6){

Thanks in advance guys!!
Title: Re: No Information in serial monitor
Post by: dannable on Jan 10, 2016, 08:31 pm
Please use code tags when pasting code into your post. See the post at the top of the page on 'How to use this forum'.

Which book? Which project?

This line doesn't look right for starters...

Code: [Select]
for(int pinNumber = 2; pinNumber,5; pinNumber ++){
Title: Re: No Information in serial monitor
Post by: 00woodm on Jan 12, 2016, 09:39 pm
Ah, I see. Sorry I see what you mean Re: code tags.

Thank you for your help. You were rite, the  comma before the 5 in the line of code you highlighted should have been a <

I did not get a compile error though, I guess this is because strictly speaking this could be a correct syntax??

In answer to your other questions and perhaps for future users the book I refer to is the Arduino Projects Book included in the starter pack. The project is number 3.

Thank you again for your help.