Hi All,
After a windows re-install I have a problem with a few programs that worked fine before the event:
The error code is has follows:
Arduino: 1.6.1 (Windows 7), Board: "Arduino Nano, ATmega328"
Using library LiquidCrystal_I2C in folder: C:\Users\Mel\Documents\Arduino\libraries\LiquidCrystal_I2C (legacy)
Using library LiquidCrystal in folder: C:\Users\Mel\Documents\Arduino\libraries\LiquidCrystal
Using library FastIO in folder: C:\Users\Mel\Documents\Arduino\libraries\FastIO (legacy)
Using library Wire in folder: C:\Users\Mel\Documents\Arduino\libraries\Wire (legacy)
Using library OneWire in folder: C:\Users\Mel\Documents\Arduino\libraries\OneWire (legacy)
Using library dallastemperaturecontrol in folder: C:\Users\Mel\Documents\Arduino\libraries\dallastemperaturecontrol (legacy)
C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10601 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs -IC:\Users\Mel\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\Mel\Documents\Arduino\libraries\LiquidCrystal\src -IC:\Users\Mel\Documents\Arduino\libraries\FastIO -IC:\Users\Mel\Documents\Arduino\libraries\Wire -IC:\Users\Mel\Documents\Arduino\libraries\OneWire -IC:\Users\Mel\Documents\Arduino\libraries\dallastemperaturecontrol C:\Users\Mel\AppData\Local\Temp\build753045471005925550.tmp\CactusPropNanoAAA.cpp -o C:\Users\Mel\AppData\Local\Temp\build753045471005925550.tmp\CactusPropNanoAAA.cpp.o
CactusPropNanoAAA.ino:18:44: error: 'POSITIVE' was not declared in this scope
Error compiling.
I think I've lost some Libraries, but then find that things like FastIO are in fact in one of the LCD libs, so what should I do! Does FastIO need to be in it's own folder named the same?
Here's my code, can you see anything wrong!! By the way, why are some of my #include coloured RED, or is that a stupid question!!
#include <LCD.h>
#include <LiquidCrystal.h>
#include <FastIO.h>
#include <I2CIO.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 12 on the Arduino
#define ONE_WIRE_BUS 12
#define DS1307_I2C_ADDRESS 0x68
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE); // Set the LCD I2C address
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/*
Connections:
Heater1 pin 3
Heater2 pin 4
SDA to Arduino Analog pin 4
SCL to Arduino Analog pin 5
LightPin Analog pin A7
TempPin pin 12
*/
//*****constants*****
int Light,LightPin=A7,TargetTemp,Heater1=3,Heater2=4,TempPin=12;
float TEMP;
void setup()
//----------------Start of Set up---------------------
{
TargetTemp=23; //Set Normal/Target temp to 23c
pinMode(Heater1,OUTPUT);
pinMode(Heater2,OUTPUT);
pinMode(13,OUTPUT);
Wire.begin();
lcd.begin(20,4); // tells Arduino the LCD dimensions
// start serial port
Serial.begin(9600);
//Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature mesurement
}
//------------End of Setup loop------------------------
//--------------Start of Main loop------------------
void loop()
{
GetTime();
GetTemp();
TestIt();
digitalWrite(13,HIGH); //LED ON
delay(100); //For 100mS
digitalWrite(13,LOW); //LED OFF
}
//------------End of main loop-----------------------------
void GetTime()
{
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
{
lcd.setCursor(0,0);
lcd.print(" ");
lcd.print(hour, DEC);
lcd.print(":");
if (minute<10)
{
lcd.print("0");
}
lcd.print(minute, DEC);
lcd.print(":");
if (second<10)
{
lcd.print("0");
}
lcd.print(second, DEC);
lcd.print(" ");
lcd.print(dayOfMonth, DEC);
lcd.print("/");
lcd.print(month, DEC);
lcd.print("/");
lcd.print("20");
lcd.print(year, DEC);
//delay(1000);
}
}
//------------------------------------------------------------------------------------------
void GetTemp()
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures(); // Send the command to get temperatures
TEMP=(sensors.getTempCByIndex(0)); // Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
}
//-----------------------------------------------------------------------------------------------------------
void TestIt()
{
Light=analogRead(LightPin);
Light=map(Light, 0, 1023, 0, 255);
if(Light>200)
{
TargetTemp=25;
}
if(Light>160 && Light<200)
{
TargetTemp=18;
}
if(Light<160)
{
TargetTemp=14;
};
// Set Temp******
lcd.setCursor(1,1);
lcd.print("Target Temp:");
lcd.print(TargetTemp);
lcd.print(".00c ");
lcd.setCursor(1,2);
lcd.print("Current Temp:");
lcd.print(TEMP);
lcd.print("c ");
if (TEMP < TargetTemp)
{
digitalWrite(Heater1,LOW); //Heater ON, Relay board uses LOW to switch relay ON.
digitalWrite(Heater2,LOW);
lcd.setCursor(1,3);
lcd.print("Heater ON ");
lcd.print(Light);
lcd.print(" ");
}
if (TEMP > TargetTemp)
{
digitalWrite(Heater1,HIGH);
digitalWrite(Heater2,HIGH); //Heater OFF, Relay board uses HIGH to switch relay OFF.
lcd.setCursor(1,3);
lcd.print("Heater OFF ");
lcd.print(Light);
if(Light <100)
{
lcd.print(" ");
}
//lcd.clear();
}
}
//*************************************************************************************************************
// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
return ( (val/10*16) + (val%10) );
}
//-----------------------------------------------------------------
// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
}
//------------------------------------------------------------------
// Gets the date and time from the ds1307
void getDateDs1307
(
byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
// Reset the register pointer
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.write(0);
Wire.endTransmission();
Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
// A few of these need masks because certain bits are control bits
*second = bcdToDec(Wire.read() & 0x7f);
*minute = bcdToDec(Wire.read());
*hour = bcdToDec(Wire.read() & 0x3f); // Need to change this if 12 hour am/pm
*dayOfWeek = bcdToDec(Wire.read() &0x07);
*dayOfMonth = bcdToDec(Wire.read());
*month = bcdToDec(Wire.read());
*year = bcdToDec(Wire.read());
}
//==================================================================================
Any help would be very welcome..
Regards
Mel.