I'll start with what I'm trying to do & then where I'm up to & my current issue.
I'm trying to do the following...
- Start on button push (implemented in code)
- Set the interval between camera shots (not finished)
- Set the number of frames to be taken (not implemented in code yet)
- Set the number of stepper steps before camera is triggered (implemented in code)
- Reset to start.
What I have achieved so far...
- Stepper attached to slide.
- Arduino control of stepper (using other code)
- LCD menu working using phi_prompt library
What my current issue is...
When I start I get no motor movement, the LCD shows "1" as it should & that is it nothing else.
Would someone be so kind as to have a look at my code & help me work through this current issue & move forward from here.
My code is split into two tabs, "My_Menu_2_1" & "menu"
Tab one ( My_Menu_2_1 )
/*
It Works...
This sketch will compile & upload giving menus that do nothing.
Next, make the menus do somthing...
*/
#include <LiquidCrystal.h>
#include <Wire.h>
#include <stdio.h>
#include <avr/pgmspace.h>
#include <phi_interfaces.h>
#include <phi_prompt.h>
#include <AFMotor.h>
#include <AccelStepper.h>
//Freetronics 16x2 LCD shield pin setting
#define LCD_RS 8
#define LCD_EN 9
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
//Freetronics 16x2 LCD shield buttons and channel pin assignments
#define lcd_rows 2
#define lcd_columns 16
#define analog_buttons_per_column 5 // Each analog pin has five buttons with resistors.
#define analog_buttons_per_row 1 // There are two analog pins in use.
#define name_length 5 // This is the max length of names.
int user_input1=1000; // This is the storage for the Frame Inrerval integer
int user_input2=10; // This is the storage for the # of Frames integer
int user_input3=175; // This is the storage for the Motor Steps integer, 175 steps per mm
int choice=0; // This is the storage for the Start control.
int shots=0; // This is the storage for the number of shots.
char analog_mapping[]={'R','U','D','L','B'}; // This is an analog keypad.
byte analog_pins[]={0}; // The pin numbers are analog pin numbers.
int values[]={0, 143, 328, 504, 740}; //mY Freetronics 16x2 LCD shield button values.
phi_analog_keypads analog_keypad(analog_mapping, analog_pins, values, analog_buttons_per_row, analog_buttons_per_column);
AF_Stepper motor2(200, 2); // This sets up the Stepper motor, motor two with 200 turns per rev
// This serial keypad is for debugging.
phi_serial_keypads debug_keypad(&Serial,115200);
// The following sets up function keys for phi_prompt library
char up_keys[]={"U"}; ///< All keys that act as the up key are listed here.
char down_keys[]={"D"}; ///< All keys that act as the down key are listed here.
char left_keys[]={"L"}; ///< All keys that act as the left key are listed here.
char right_keys[]={"R"}; ///< All keys that act as the right key are listed here.
char enter_keys[]={"B"}; ///< All keys that act as the enter key are listed here.
char escape_keys[]={"A"}; ///< All keys that act as the escape key are listed here.
char * function_keys[]={up_keys,down_keys,left_keys,right_keys,enter_keys,escape_keys}; ///< All function key names are gathered here fhr phi_prompt.
// The following adds all available keypads as inputs for phi_prompt library
multiple_button_input * keypads[]={&analog_keypad, &debug_keypad,0};
// The following sets up LCD and other objects
LiquidCrystal lcd(LCD_RS,LCD_EN,LCD_D4,LCD_D5,LCD_D6,LCD_D7); // Create the lcd object
void setup()
{
lcd.begin(lcd_columns, lcd_rows);
init_phi_prompt(&lcd,keypads,function_keys, lcd_columns, lcd_rows, '~'); // Supply the liquid crystal object, input keypads, and function key names. Also supply the column and row of the lcd, and indicator as '>'. You can also use '\x7e', which is a right arrow.
Serial.begin(115200); // Serial is used as a debug keypad. This can be deleted after debug.
}
void loop() {
top_menu(); // See menu.pde for the Macro Slide Menu
}
Too big...
See next post...