A new project I've just finished using an Arduino Mega, Lithium battery pack, TL230R frequency to light convertor IC and the DS1307 RTC and a 20x4 LCD display. It uses non-blocking timing code and and an interrupt with MsTimer2 so that the buttons remain fully functional when taking images rather than using the easier delay() function. It's been done a thousand times before but as a photographer I do like the control this system is giving me when using the camera in bulb mode and modifying the pulse length to adjust the shutter speed.
It is based on a system developed on the OpenMoco site but I'm very pleased with the end result. It can also be used as a simple intervalometer with interval and pulse adjustments.
The one I purchased has rails to take a 100x150mm vero board. It also has removable ends and one side panel slides off which makes the machining very simple.
Not going to disagree with that statement lol although they are useful for the occasional plug and socket and they have some really nice aluminium enclosures
right. Still don't quite understand what values it is but you will want to look up EEPROMwriteanything. Just do a search for it and there is some info on it. It's pretty simple to use.
I looked over the code you posted briefly, but could not find where you are doing the frequency input processing for the TL230R frequency to light convertor IC ? Probably just old eyes at this end.
I bought this IC from SparkFun some time ago, but haven't come up with a application for it and it does not seem that simple a task, depending on if you want to utilize the full range of the sensor.
Mowcius: thank you for the link, it's exactly what i want. If I change any of the presets in the software on the fly it will allow me to save those values rather than changing the values in code and reloading the programme.
Mowcius: thank you for the link, it's exactly what i want. If I change any of the presets in the software on the fly it will allow me to save those values rather than changing the values in code and reloading the programme.
Using the EEPromwriteanything routines I added a routine to monitor a button press on power up , If the button is pressed the EEprom values should load from memory but nothing seems to happen
I've added these functions before the setup()
// functions for memory read/write
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
const byte* p = (const byte*)(const void*)&value;
int mem;
for (mem = 0; mem < sizeof(value); mem++)
EEPROM.write(ee++, *p++);
return mem;
}
template <class T> int EEPROM_readAnything(int ee, T& value)
{
byte* p = (byte*)(void*)&value;
int mem;
for (mem= 0; mem < sizeof(value); mem++)
*p++ = EEPROM.read(ee++);
return mem;
}
// values to read/write to Eeprom
struct config_t
{
long INTERVAL_TM;
long EXPOSURE_TM;
} configuration;
INTERVAL_TM and EXPOSURE_TM are the values I want to read and write from memory.
in the setup() loop I've added this to check for a button press on power up and if pressed load the variables from memory. If not pressed the default values are used.
// check if Centre button is pressed on startup. If HIGH load values from memory
if( digitalRead(B_CT) == HIGH)
{
EEPROM_readAnything(0, configuration);
lcd.setCursor(0, 1);
lcd.print("Saved values loaded");
delay(1000);
lcd.clear();
}
Everytime I vary the values of the two variables I use this code to write the new values to memory
but it doesn't work I know the programme is seeing the button press as I get "saved values loaded" but the values that get used are the default ones defined earlier in the programme.
Any thoughts or obvious errors I've made would be appreciated.
I am tired so I can't really think properly but are you sure you can do it that way? I thought you would have to do a different one for each value you want to save and read.
I have no really looked into it that much. The most I have done is saved a floating point variable with it
My mistake I wasn't assigning the data EEPROM_readAnything was getting to my own variables and likewise I wasn't assigning my data to the configuration.variables before using EEPROM_writeAnything to write to the EEPROM.
The revised code in setup() is:
// check if Centre button is pressed on startup.
// If LOW load values from memory and overwirte default values (default is to load memory values)
// if HIGH use default values
if( digitalRead(B_CT) == LOW)
{
EEPROM_readAnything(0, configuration);
INTERVAL_TM = configuration.INTERVAL_TM;
EXPOSURE_TM = configuration.EXPOSURE_TM;
lcd.setCursor(0, 1);
lcd.print(" Saved data loaded");
lcd.setCursor(0, 2);
lcd.print("Press FIRE to reset");
delay(1000);
lcd.clear();
}
else
{
lcd.setCursor(0, 1);
lcd.print("Default data loaded");
delay(1000);
lcd.clear();
}
the "press FIRE to reset" is a visual prompt if I want to reset the system i.e. press and hold the FIRE button and turn the arduino on for default values