Welcome! Log In Create A New Profile

Advanced

Running broken Melzi board + stepper AND LCD 2004

Posted by IamTheVector 
Running broken Melzi board + stepper AND LCD 2004
October 27, 2019 08:00PM
SOLVED
Quote

I would like to run a broken melzi board with just a motor with a sketch of my own.

I found the pin for enable and direction inside the repetier configuration.

And i found those examples.

[howtomechatronics.com]


The problem is, if i put those pin value the board is not moving the stepper at all.

Now i would like to use the LCD 2004, i managed to comunicate with the melzi and the liquid crystal library, but unable to find the keys or the methos to call the 5 button present on the tronxy LCD2004 Zonestar

Edited 2 time(s). Last edit at 10/28/2019 05:12PM by IamTheVector.
Attachments:
open | download - 1233333333.JPG (146.3 KB)
Re: Running broken Melzi board + stepper
October 27, 2019 09:29PM
Your code does not enable the stepper driver

Pin 14 needs to be low. This enables the X, Y and E steppers. Z has its own enable pin.

Edited 1 time(s). Last edit at 10/27/2019 09:36PM by Dust.
Re: Running broken Melzi board + stepper
October 28, 2019 02:28AM
Quote
Dust
Your code does not enable the stepper driver

Pin 14 needs to be low. This enables the X, Y and E steppers. Z has its own enable pin.

Thanks it works, that was quite unclear.
Re: Running broken Melzi board + stepper AND LCD 2004
October 28, 2019 05:14PM
Now i would like to use the LCD 2004, i managed to comunicate with the melzi and the liquid crystal library, but unable to find the keys or the methos to call the 5 button present on the tronxy LCD2004 Zonestar



Edited 1 time(s). Last edit at 10/28/2019 05:15PM by IamTheVector.
Re: Running broken Melzi board + stepper AND LCD 2004
October 28, 2019 05:51PM
//Sample using LiquidCrystal library
#include
/*******************************************************

This program will test the LCD panel and the buttons
Mark Bramwell, July 2010

********************************************************/
// initialize the library with the numbers of the interface pins
#define UI_DISPLAY_ENABLE_PIN 29
#define UI_DISPLAY_RS_PIN 28
#define UI_DISPLAY_RW_PIN -1
#define UI_DISPLAY_D4_PIN 10
#define UI_DISPLAY_D5_PIN 11
#define UI_DISPLAY_D6_PIN 16
#define UI_DISPLAY_D7_PIN 17
#define UI_DISPLAY_ADC_PIN 1

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(UI_DISPLAY_RS_PIN, UI_DISPLAY_ENABLE_PIN, UI_DISPLAY_D4_PIN, UI_DISPLAY_D5_PIN, UI_DISPLAY_D6_PIN, UI_DISPLAY_D7_PIN);


// define some values used by the panel and buttons
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5

// read the buttons
int read_LCD_buttons()
{
adc_key_in = analogRead(UI_DISPLAY_ADC_PIN); // read the value from the sensor
// my buttons when read are centered at these valies: 0, 144, 329, 504, 741
// we add approx 50 to those values and check to see if we are close
if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
// For V1.1 us this threshold
if (adc_key_in > 450 && adc_key_in < 550) return btnRIGHT;
if (adc_key_in > 630 && adc_key_in < 730) return btnUP;
if (adc_key_in > 129 && adc_key_in < 229 ) return btnDOWN;
if (adc_key_in > 44 && adc_key_in < 144 ) return btnLEFT;
if (adc_key_in > 270 && adc_key_in < 370) return btnSELECT;





// LEFT 94 150

//DOWN 179 300

//CENTER 320 400

//RIGHT 500 600

//UP 680 1000


//
// { 300, 500, UI_ACTION_BACK }, // Left
// { 570, 870, UI_ACTION_PREVIOUS }, // Up
// { 1150, 1450, ADC_KEYPAD_CENTER_ACTION }, // Center
// { 1900, 2200, UI_ACTION_OK }, // Right
// { 2670, 2870, UI_ACTION_NEXT } // Down

// For V1.0 comment the other threshold and use the one below:
/*
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 195) return btnUP;
if (adc_key_in < 380) return btnDOWN;
if (adc_key_in < 555) return btnLEFT;
if (adc_key_in < 790) return btnSELECT;
*/


return btnNONE; // when all others fail, return this...
}

void setup()
{
Serial.begin(9600);
lcd.begin(16, 2); // start the library
lcd.setCursor(0,0);
lcd.print("Push the buttons"); // print a simple message
}

void loop()
{
Serial.println(adc_key_in);
lcd.setCursor(9,1); // move cursor to second line "1" and 9 spaces over
lcd.print(millis()/1000); // display seconds elapsed since power-up


lcd.setCursor(0,1); // move to the begining of the second line
lcd_key = read_LCD_buttons(); // read the buttons

switch (lcd_key) // depending on which button was pushed, we perform an action
{
case btnRIGHT:
{
lcd.print("RIGHT ");
break;
}
case btnLEFT:
{
lcd.print("LEFT ");
break;
}
case btnUP:
{
lcd.print("UP ");
break;
}
case btnDOWN:
{
lcd.print("DOWN ");
break;
}
case btnSELECT:
{
lcd.print("SELECT");
break;
}
case btnNONE:
{
lcd.print("NONE ");
break;
}
}

}

Edited 1 time(s). Last edit at 10/28/2019 06:06PM by IamTheVector.
Re: Running broken Melzi board + stepper AND LCD 2004
October 28, 2019 06:26PM
This is a "ZONESTAR_LCD" in marlin

It uses a single analog input for all switches "ADC_KEYPAD_PIN" in marlin
This is analog pin 1

so in your loop you need to read analog pin 1, it will change when a button is pressed.

I dont know the exact details.. never had this display
Sorry, only registered users may post in this forum.

Click here to login