Ok, I've got to the point where I need some help please.
I have put together code structure for controlling 2 axis stoppers via DM542 digital drivers with some added features.
all is not working as intended! except however, as you will see in the code, I need the Arduino UNO to store locations of both axis, when I get both axis independently move to a new location (by rolling the MPG encoder wheel) and store that location by pressing the store button and that should memories that location, I then move both axis to another new location and do the same again to store that location etc etc... (roughly around 5 locations or much the EEPROM can handle)
Once all that is done I then need to be able to move both axis together to a specific location where I previously stored in the Arduino's EEPROM, by pressing the previous and next buttons (ie; cycle through to find the location I need - depending on how many clicks up or down I need to go). Optionally, I don't want them to have automatic permissive, until a latching (ON / OFF) is engaged to give the 'previous' and 'next' buttons the permissive to function.
So far that is not what's happening.
just to put other things in the mix, there are other functions to the code that is actually working now.
ie: Home button / E-stop / MPG activate & de-activate.
# Home button - first ever press on the store button soon after Arduino reset, I need it to be default 'home' position. every time the home button = pin 10 is pressed there after, I need both axis to move to that first ever stored position, so EEPROM to store and remember this location until a next Arduino reset. (that works OK)
# Store button - needs to store current locations of both axis, as they are moved by MPG wheel to their new locations and this button on pin 12 is high by pressing it. this should store up to 5 different locations (or however many EEPROM Can handle) for both axis, besides initial home location. so EEPROM needs store and remember this location until called upon by 'next' & 'prev' buttons.
# Recall Button - on pin 13, is a latching switch that when activated should enable the access to EEPROM's five different stored locations. This should be latched (when HIGH) to give permissive for either next or prev buttons (or Pins 0 & 1), without the Recall button being activated, any accidental press on the Prev or Next buttons (when Recall pin LOW) will be dormant when pressed.
# Next button - by user pressing the 'nextButton' on pin 0 , that action should select up (cycle up) stored locations. each press should count up to 5 consecutive locations (or whatever the amount that EERPOM can store).
# Prev button - by user pressing the 'prevButton' on pin 1 , that action should select down (cycle down) stored locations. each press should count down to 5 consecutive locations.(or whatever the amount that EERPOM can store).
So the pushbutton wire connections to Arduino pins are on an external pull up resister architecture;
One end of the switch button is connected to a 10Kohm resister that is supplied from 5V supply and the other end of the resister is connected to Arduino pin (as shown in the diagram) the other End of the Switch Connected to Ground: When the switch is closed (pressed), it connects the input pin directly to ground, pulling the pin to a LOW state (0V). This change in state from HIGH to LOW is what the microcontroller detects as the switch being activated.
So, the actual problem I am having is that when I press the store button to store it seems to move to home location or where ever the last location, not sure it actually store the locations. Also, the recall/previous/next options aren't working at all!!
can anyone help please?
Thanks.