Welcome! Log In Create A New Profile

Advanced

Replace Ramps LCD by button

Posted by Rickalac 
Replace Ramps LCD by button
May 20, 2019 04:46AM
Hello All,

I am working on my first 1.6 Ramps, with Arduino Mega and 3 stepper motors + A4988 drivers ( 3 axes X Y Z). I will not pilot them via Marlin firmware, but only with Accelstepper library (I am not building a 3D printer). My goal is to pilot the motors, using push buttons. The problem is, I don't know where to connect the buttons ?
Since I won't be using LCD / endstops / servos, I have plenty of pins available on the Ramps, but I don't know how to adress them in my code. For exemple : Pins D16 to D32 are free, but the Arduino won't recognize "D16".

I found the "Mega2560 pinout" but I can't find out what Mega's pin is linked to Ramps D16 pin. Thank you for your help.

Rick
Re: Replace Ramps LCD by button
May 20, 2019 07:38AM
the ramps pins use the same names as the mega pins

D16 on ramps is D16 on the mega

you dont use the D when coding....

eg
/*
  Button

  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 16.

  The circuit:
  - LED attached from pin 13 to ground
  - pushbutton attached to pin 16 from +5V
  - 10K resistor attached to pin 16 from ground

  - Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

  created 2005
  by DojoDave [www.0j0.org]
  modified 30 Aug 2011
  by Tom Igoe

  This example code is in the public domain.

  [www.arduino.cc]
*/

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 16;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}
Re: Replace Ramps LCD by button
May 20, 2019 11:54AM
Hello Dust,

I can't believe it was that simple eye popping smiley
Thank you for your help.

Rick
Sorry, only registered users may post in this forum.

Click here to login