Regarding SPI.h library pins

hi guys i am using REP-RAP display with esp32.

REP RAP DISPLAY


this display will work on SPI protocol.
this display has a knob. i do not know how it works.

now this REP-RAP board is connect to ESP32.
this ESP32 is also connected to LORA which also works on SPI.

now my problem is LORA module is not getting initialize .

i do not know why???

the code is :slight_smile:



#include <Arduino.h>
#include <SPI.h>
#include <menu.h>
#include <menuIO/u8g2Out.h>
#include <menuIO/encoderIn.h>
#include <menuIO/chainStream.h>
#include <menuIO/serialOut.h>
#include <menuIO/serialIn.h>
#include <menuIO/U8GLibOut.h>
#include <ClickEncoder.h>
#include <menuIO/clickEncoderIn.h>
#include <EEPROM.h>

/*==============================================
  Declrations:Rotary Encoder pins
  ==============================================*/
#define encA    14
#define encB    15
#define encBtn  25
hw_timer_t * timer = NULL;
ClickEncoder clickEncoder(encA, encB, encBtn, 2);
ClickEncoderStream encStream(clickEncoder, 1);
MENU_INPUTS(in, &encStream);
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
void IRAM_ATTR onTimer() {
  portENTER_CRITICAL_ISR(&timerMux);
  clickEncoder.service();
  portEXIT_CRITICAL_ISR(&timerMux);
}

/*==============================================
  Declrations: Display Configuration
  ==============================================*/
#define USE_SWSPI
#define fontName  u8g2_font_5x7_tf
#define offsetX 0
#define offsetY 0
#define U8_Width 128
#define U8_Height 64
int x = 0;
int scroll_direction = 1;
U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 23 /* A2 */, /* CS=*/ 5 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
const colorDef<uint8_t> colors[6] MEMMODE = {
  {{0, 0}, {0, 1, 1}}, //bgColor
  {{1, 1}, {1, 0, 0}}, //fgColor
  {{1, 1}, {1, 0, 0}}, //valColor
  {{1, 1}, {1, 0, 0}}, //unitColor
  {{0, 1}, {0, 0, 1}}, //cursorColor
  {{1, 1}, {1, 0, 0}}, //titleColor
};

#define display_ss 5

//******************LORA PINS

#include <LoRa.h>

#define ss 4
#define rst 12
#define dio0 13
int counter=0;
void setup() 
{
  Serial.begin(115200);
  pinMode(display_ss, OUTPUT);
  pinMode(ss, OUTPUT);
  SPI.begin(18,19,23,5);
  u8g2.begin();
  //pinMode(encBtn, INPUT_PULLUP);
  x = x + scroll_direction;
  if (x > 40) scroll_direction = -1;
  if (x < 1) scroll_direction = 1;
  u8g2.setFont(fontName);
  nav.idleTask = idle;
  digitalWrite(display_ss,HIGH);
  digitalWrite(ss,LOW);
  
  Serial.println("WELCOME TO LORA TESTING");
  SPI.begin(18,19,23,ss);
  LoRa.setPins(ss, rst, dio0);
  while (!LoRa.begin(433E6)) 
  {
    Serial.println("Starting LoRa failed!");
    delay(1000);
  }
  Serial.println("LORA CONNECTED");
  digitalWrite(display_ss,LOW);
  digitalWrite(ss,HIGH);
  
}

void loop() 
{
  Encoderrun();
  delay(1000);
  sendMessage();

}

i do not understand what to do?
@UKHeliBob , @sterretje , @srnet , @b707