Welcome! Log In Create A New Profile

Advanced

Remapping Pins for Non-printer

Posted by Corbid 
Remapping Pins for Non-printer
September 19, 2024 09:30PM
I'm having some issues with figuring out how to remap a pin and could use some help.

I'm putting together a 3D scanner that is based off of this system ( [github.com] )
I've had to make a lot of adjustments, but I'm almost done and just need to get my shutter release working.
For the shutter release, I've put together something similar to what's done in the following link and got it working using the basic blink sketch on an Arduino Uno ( [baltimorenode.org] )

For the scanner, I'm using Marlin on a Mega paired with a ramps 1.6 board. In the original scanner's sample gcodes, they used pin 32 to send the signal to trigger the camera.
Here's a little sample of that code:
(-------------------------------Rotate 1)
G4 P500 (Pause before camera trigger) 
M42 P32 S0 (Camera trigger ON)
G4 P600 (Pause before camera trigger)
M42 P32 S255 (Camera trigger OFF)
(-------------------------------Rotate 2 22.5)
G0 E6 F400
G4 P500 (Pause before camera trigger) 
M42 P32 S0 (Camera trigger ON)
G4 P600 (Pause before camera trigger)
M42 P32 S255 (Camera trigger OFF)
(-------------------------------Rotate 3 45)
G0 E6 F400
G4 P500 (Pause before camera trigger) 
M42 P32 S0 (Camera trigger ON)
G4 P600 (Pause before camera trigger)
M42 P32 S255 (Camera trigger OFF)

Unfortunately, I'm using a RepRapDiscount Full Graphic Smart Controller, and so all the pins from the AUX-4 group are occupied.
I'd read examples of using open endstop pins or other AUX pins as alternatives, but pointing directly to those pins doesn't work.
I've seen that remapping pins in the pins_arduino.h file may be where to sort this out, but I don't really see a clear explanation of how to do it.
Any help or guidance would be greatly appreciated!
Re: Remapping Pins for Non-printer
September 20, 2024 12:44AM
you don't need to remap any pins. (unless your trying to use a pin marlin has already allocated)

remapping is for pins that have a function in marlin.

your using direct pin control "M42 P32 S0" [marlinfw.org]
P32 is the pin your settings (Arduino pin name D32)

Use D4 or D5 on the Servo plug, just change M42 P32 S0 to M42 P4 S0 etc.

The main catch is you cannot use locked pins (pins controlled by marlin) .. do a M43 to list all pins and if they are locked or not

Edited 5 time(s). Last edit at 09/20/2024 01:22AM by Dust.
Re: Remapping Pins for Non-printer
September 21, 2024 08:02AM
Worked like a charm. Thanks for the M43 tip!
Sorry, only registered users may post in this forum.

Click here to login