scope scope scope

Hi,
I am new to this environment. So a couple of questions about scope and options on storing things: First let me list this my first arduino program:
code
*

//#include <CmdMessenger.h> // CmdMessenger
//#include <printf.h>
#include <arduino.h>
//OUTPUTS

#define PIN_LED 6
#define Fan1 2
#define Fan2 3
#define Heater1 4
#define Heater2 5
#define UpButton 8
#define DownButton 9

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);

//Enable Inputs
pinMode(UpButton, INPUT);
pinMode(DownButton, INPUT);
pinMode(PIN_LED, OUTPUT);
pinMode(Heater1, OUTPUT);
pinMode(Heater2, OUTPUT);
pinMode(Fan1, OUTPUT);
pinMode(Fan2, OUTPUT);
//digitalWrite(PIN_LED, HIGH);
Serial.println(“Begin”);
}

void loop()
{
// put your main code here, to run repeatedly:

// get buttons

int timeTrackUp = 0; // used to keep track of how long the up button has been held down
int timeTrackDown = 0; // used to keep track of how long the down button has been held down
float tempSetPoint;
float tempActualA;
float tempActualB;
float averageTemp;
int analog1;
int analog2;
int tempChange;
int thermo1 = 14;
int thermo2 = 15;
int ledcount = 0;
digitalWrite(PIN_LED, HIGH);
#ifdef debug then
Serial.println(“Running”);
#endif
if (digitalRead(UpButton))
{
delay(10);
if (digitalRead(UpButton))
{
#ifdef debug then
Serial.println(“Up”);
#endif
}
}
if (digitalRead(DownButton))
{
delay(10);
if (digitalRead(DownButton))
{
#ifdef debug then
Serial.println(“Down”);
#endif
}
}

// read temps
analog1 = analogRead(thermo1);
analog2 = analogRead(thermo2);
// insert convert code here.
tempActualA = (float) analog1 / 760 * 450;
tempActualB = (float) analog2 / 760 * 450;
averageTemp = (tempActualA + tempActualB) / 2;

delay(1000);
digitalWrite(PIN_LED,LOW);
if (averageTemp < (tempSetPoint -2))
{
digitalWrite(Fan1,HIGH);
digitalWrite(Fan2,HIGH);
digitalWrite(Heater1,HIGH);
digitalWrite(Heater2,HIGH);
}

if (averageTemp > (tempSetPoint +2))
{
digitalWrite(Fan1,LOW);
digitalWrite(Fan2,LOW);
digitalWrite(Heater1,LOW);
digitalWrite(Heater2,LOW);
}

if ((tempSetPoint <=1))
{
digitalWrite(Fan1,LOW);
digitalWrite(Fan2,LOW);
digitalWrite(Heater1,LOW);
digitalWrite(Heater2,LOW);
}

delay(1000);

}

void printtemps(int settemp, int temp1, int temp2)
// sends the set point and temps to the display
{
char st[10];
char tp1[10];
char tp2[10];
serial.write(254);
serial.write(128); //home the display
serial.write(“st: “);
serial.write(“t1: t2: “);
sprintf(st,”%3d”,settemp);
sprintf(tp1,”%3d”,temp1);
sprintf(tp2,"%3d",temp2);

serial.write(254);
serial.write(128); // first position on first line
serial.write(st); // write the setpoint

serial.write(254);
serial.write(192);// first position on second line
serial.write(st); // write the setpoint

serial.write(254);
serial.write(200);//eight position on second line
serial.write(st); // write the setpoint

}
*
end code
When I first started this not knowing any better I put the code in the main arduino folder (\program files (x86)\arduino) under a folder with the same name as the project. When I compiled I got an error that the function printtemps was out of scope. So I started to create a header file and then read some online files and discovered I should have put this in the default location which on my machine is \users\jeff\Documents\arduino. So I moved it and created a header file in a folder with the project name under the libraries folder in that area. Now when I compile it tells me serial is out of scope. Serial is of course part of the core arduino files so I’m wondering what I need to add/change to make this work.
Part 2 of this question is: I am starting to use arduino for many projects. I usually organize my files project centric, that is I make a folder with the project name and put everything associated with it including software in subfolders. Is this possible in this environment?
Thanks

Serial is of course part of the core arduino files

Yes, but serial isn't.

so I'm wondering what I need to add/change to make this work.

I would think that that was obvious.

And you even got it right in Setup()!

Here is where paying attention to line numbers is important. If it flags a line with serial, but not Serial, that should be a big clue.

And thank you for pointing it out. Perhaps one day when I've done this enough times it will be obvious, but my bigger question was about how the arduino environment is aware of files. If serial is not inherent but a library file, I would have thought that I would have to make a specific declaration to it. I should look at the arduino.h file to learn more I suppose. My bigger question is whether I can put these files in folders other than where arduino natrually puts them and how that affects assumtions made by the compiler. Again thank you for your help.

Library stuff:

If serial is not inherent but a library file, I would have thought that I would have to make a specific declaration to it.

Serial is an instance of the HardwareSerial class (for most Arduinos; for the rest it is an instance of a different, but similar, class). The HardwareSerial class is included in Arduino.h. Including Arduino.h in the sketch, which the IDE does for you, causes the Serial instance to be created.

I should look at the arduino.h file to learn more I suppose.

Couldn't hurt.

My bigger question is whether I can put these files in folders other than where arduino natrually puts them

As long as you don't mind that the IDE will copy them to where it wants them, sure.

and how that affects assumtions made by the compiler.

The compiler makes no assumptions. It's about the stupidest piece of software on your computer. It knows exactly how you screwed up, but, even when it is perfectly obvious what needs to be done (; missing at end of line 28. Well, why the hell didn't you just add one?) it won't do it.

It is the IDE that "makes assumptions". It doesn't really. It enforces its expectations, and copies the stuff to be compiled to a build directory before invoking the compiler, linker, and uploader.

Thanks Paul, that's just what I was looking for. When work slows down I will have to spend some time browsing around.
Jeff