I have created myself a pendent using a encoder handwheel, Lcd, poti for feed rate, menbrane switch matrix and an arduino Nano.
I run it on a lowrider with a ramps board connected to the serial 1 port pins on the ramps Zmax and Zmin,
It works perfectly when I use it for setting up jobs, but when I use octoprint it is causing issues, the job stops and says too many errors, or somelike that… I’m not at the work shop…
Furthermore, I set up out the job with the pendant, place it in its holder and start the job with octoprint that is running on a raspberry pi 4. When the pendant is not connected it works fine.
my arduino code only sends data after an event, so I not sure why its happening…
any ideas??
in the marlin setup of have enable both ports.
#define SERIAL_PORT 0
#define SERIAL_PORT_2 1
my arduino code(Ps Im not a programmer.)…
// Code based on this thing
// https://makerware.thingiverse.com/thing:1563410
#include <Keypad.h>
#include <EEPROM.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
char Axis = ‘Z’;
char key = ‘3’;
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
float Vorschrub = 0.01;
char keys[ROWS][COLS] = {
{‘1’,‘2’,‘3’,‘A’},
{‘4’,‘5’,‘6’,‘B’},
{‘7’,‘8’,‘9’,‘C’},
{’*’,‘0’,’#’,‘D’}
};
byte rowPins[ROWS] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad
#include <SimpleRotary.h>
//Create an object of keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
SimpleRotary rotary(2,3,-1);
int sensorValue = 0; // value read from the pot
int neusensorValue = 0; // value output to the PWM (analog out)
int sensorPin = 14;
int sensorpercent = 100;
void setup(){
Serial.begin(250000);
lcd.init(); // initialize the lcd
lcd.init();
lcd.backlight();
lcd.clear();
lcd.setCursor(0,0);
keypad.addEventListener(keypadEvent); // Add an event listener for this keypad
}
void loop() {
sensorValue = analogRead(sensorPin);
sensorpercent = map(sensorValue, 0, 1023, 0, 101); //Map value 0-1023 to 0-130%
if (sensorpercent != neusensorValue) {
Serial.print(“M220 S”);
Serial.println(sensorpercent);
lcd.print(" “);
lcd.setCursor(12,0);
lcd.print(sensorpercent);
lcd.print(”%");
neusensorValue = sensorpercent;
}
byte i;
// 0 = not turning, 1 = CW, 2 = CCW
i = rotary.rotate();
if ( i == 1 ) {
Serial.println("G91");
Serial.print("G0 ");
Serial.print(Axis);
Serial.println(Vorschrub);
Serial.println("G90");
}
if ( i == 2 ) {
Serial.println("G91");
Serial.print("G0 ");
Serial.print(Axis);
Serial.print("-");
Serial.println(Vorschrub);
Serial.println("G90");
}
char key = keypad.getKey();// Read the key
}
// Taking care of some special events.
void keypadEvent(KeypadEvent key){
switch (keypad.getState()){
case PRESSED:
// Achse
if (key == '1') { // X =1, Y=2, Z=3
Axis = 'X';
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("X-Achse");
}
if (key == ‘2’) {
Axis = ‘Y’;
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print(“Y-Achse”);
}
if (key == '3') {
Axis = 'Z';
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("Z-Achse");
}
// Vorschub
if ((Axis == 'X'||'Y')&&(key == '4')){
Vorschrub = 0.1;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(Vorschrub);
lcd.print("mm Vorschub");
}
if ((Axis == 'X'||'Y')&&(key == '5')){
Vorschrub = 1;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(Vorschrub);
lcd.print("mm Vorschub");
}
if ((Axis == 'X'||'Y')&&(key == '6')){
Vorschrub = 10;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(Vorschrub);
lcd.print("mm Vorschub");
}
if ((Axis == 'Z')&&(key == '4')){
Vorschrub = 0.01;
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(Vorschrub);
lcd.print("mm Vorschub");
}
if ((Axis == ‘Z’)&&(key == ‘5’)){
Vorschrub = 0.1;
lcd.setCursor(0,1);
lcd.print(" “);
lcd.setCursor(0,1);
lcd.print(Vorschrub);
lcd.print(“mm Vorschub”); ;
}
if ((Axis == ‘Z’)&&(key == ‘6’)){
Vorschrub = 1;
lcd.setCursor(0,1);
lcd.print(” ");
lcd.setCursor(0,1);
lcd.print(Vorschrub, 3);
lcd.print(“mm Vorschub”);
break;
case RELEASED:
if (key == '1') {
}
break;
case HOLD:
if (key == '*') {
lcd.backlight();
delay(200);
lcd.backlight();
Serial.println("G92 X0");
Serial.println("M300 S392 P436");
}
if (key == '0') {
lcd.backlight();
delay(200);
lcd.backlight();
Serial.println("G92 Y0");
Serial.println("M300 S392 P436");
}
if (key == '#') {
lcd.backlight();
delay(200);
lcd.backlight();
Serial.println("G92 Z0");
Serial.println("M300 S392 P436");
}
if (key == 'A') {
lcd.backlight();
delay(200);
lcd.backlight();
Serial.println("G90");
Serial.println("G0 Z15");
Serial.println("G0 X0 Y0");
}
if (key == 'D') {
lcd.backlight();
delay(200);
lcd.backlight();
Serial.println("G92 Y0 X0 Z0");
Serial.println("M300 S392 P436");
}
break;
}
}
}