I am new to the Arduino but have been running several programs without problems until I loaded 1.0
I downloaded and installed version 1.0 and I am seeing the same problem with A0. I have an additional error that I think may be causing the problem, Arduino.h File or directory not found. How do I tell the compiler where to find this file?
Below are the errors that I got from a program that in earlier versions compile without errors.
ARDUINO 1.0 Error Compilling
Meas_if_greater_then_12_5_volts.cpp:17:23: error: Arduino.h: No such file or directory
Meas_if_greater_then_12_5_volts.pde:-1: error: 'A0' was not declared in this scope
Meas_if_greater_then_12_5_volts.cpp: In function 'void setup()':
Meas_if_greater_then_12_5_volts.pde:-1: error: 'Serial' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'OUTPUT' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'pinMode' was not declared in this scope
Meas_if_greater_then_12_5_volts.cpp: In function 'void loop()':
Meas_if_greater_then_12_5_volts.pde:-1: error: 'analogRead' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'map' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'Serial' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'BYTE' was not declared in this scope
As of Arduino 1.0, the 'BYTE' keyword is no longer supported.
Please use Serial.write() instead.
Meas_if_greater_then_12_5_volts.pde:-1: error: 'delay' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'HIGH' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'digitalWrite' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'LOW' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'LOW' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'digitalWrite' was not declared in this scope
Meas_if_greater_then_12_5_volts.pde:-1: error: 'HIGH' was not declared in this scope
Any assistance would be greatly appreciated.
Here is the full program below
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int Grnled1 = 8;
const int Redled2 = 9;
const int Grnled3 = 10;
int Instr = 254;
int CLR = 1;
int sensorValue = 0; // value read from the pot
float outputValue = 0; // value output to the PWM (analog out)
int startpos = 128; // upper left displat pos
int line2 = 192; // line 2 start pos
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
// initialize pin 8,9 & 10 as outputs
pinMode(Grnled1, OUTPUT);
pinMode(Redled2, OUTPUT);
pinMode(Grnled3, OUTPUT);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
float outputValue = map(sensorValue, 0, 1023, 0, 255);
// the 3 in the below formular is the multiplier for the resistor bridge combination (2K & 1K)
// This reduces the outputValue by 1/3 so that 15 volts will look like 5 volts. And that why it needs
// to be multiplied by 3 before it is sent to the display.
// Added + .5 below to fix measure error
float Voltage = (((5 * outputValue)/255)*3)+.5;
// print the results to the serial monitor:
Serial.print(Instr, BYTE); //Instruction coming
Serial.print(CLR, BYTE); // Clear display
delay(10);
Serial.print(Instr, BYTE); //Instruction coming
Serial.print(startpos, BYTE); // move to upper left line
if (Voltage >= 12.5) {
Serial.print("Voltage >= 12.5");
digitalWrite(Grnled1, HIGH);
digitalWrite(Redled2, LOW);
goto goaround;
}
Serial.print("sensor = " );
Serial.print(sensorValue);
digitalWrite(Grnled1, LOW);
digitalWrite(Redled2, HIGH);
goaround:
Serial.print(Instr, BYTE); //Instruction coming
Serial.print(line2, BYTE); // move to begining of line 2
Serial.print("Volt = ");
Serial.print(Voltage);
delay(50);
}