Dears
Good morning,
It's my first time working with these communication.
So my idea is to capture some voltages from UNO + ADS1115 an send datas to ESP32 and SHARP display. And different values from voltages show different text.
But it seems that ESP 32 + SHARP don't work.
On contrary, i received this note :
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled
Core 1 register dump:
PC : 0x400d1eb6 PS : 0x00060430 A0 : 0x800f37e5 A1 : 0x3ffb2130
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x0000ffff
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000007 A9 : 0x00000090
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000014 A13 : 0x00000004
A14 : 0x3ffb8188 A15 : 0x80000001 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x40086809 LEND : 0x40086819 LCOUNT : 0xfffffffc
Backtrace: 0x400d1eb3:0x3ffb2130 0x400f37e2:0x3ffb2150 0x400d17b1:0x3ffb2170 0x400d1a32:0x3ffb21d0 0x400f3c05:0x3ffb2200 0x400d2d53:0x3ffb2220 0x400d2d65:0x3ffb2240 0x400d1538:0x3ffb2260 0x400d314e:0x3ffb2290
ELF file SHA256: 9e1bc8b0e48a62d1
with these codes :
From Uno (sender):
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
#include <SoftwareSerial.h>
// Serilal communication
SoftwareSerial softPort(-1,9); //Rx not declared, TX
// Initialize the ADS1115 with the default address (0x48)
Adafruit_ADS1X15 ads;
void setup() {
Serial.begin(9600);
Wire.begin();
ads.begin();
}
void loop() {
int16_t adc0 = ads.readADC_SingleEnded(0);
// Read the voltage from channel 0 (A0) of the ADS1115
float voltage = adc0 * 0.0001875; // Convert ADC value to voltage
String voltageStr = String(voltage, 2); // Convert voltage to a string
Serial.println(voltageStr); // Send the voltage to esp32 via serial communication
delay(1000);// Wait for 1 second before taking the next reading
}
to ESP 32 (receiver):
#include <Adafruit_GFX.h>
#include <Adafruit_SharpMem.h>
#include <WiFi.h>
#include <Wire.h>
// any pins can be used
#define SHARP_SCK 13
#define SHARP_MOSI 11
#define SHARP_SS 10
//CONNECTION ARDUINO UNO AND ESP 32
#define TXp2 9
// Set the size of the display here, e.g. 240x400!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices! The original display (96x96 pixels)
// does work there, but is no longer produced.
#define BLACK 0
#define WHITE 1
int minorHalfSize; // 1/2 of lesser of display width or height
void setup()
{
display.print ("Fungi World:");
display.setTextSize(1);
display.setTextColor(BLACK);
display.setCursor(0,0);
Serial.begin(115200);
Wire.begin(9600, SERIAL_8N1,TXp2);
}
void loop ( )
{
if(Wire.available() > 0)
{
String voltageStr = Serial.readString(); // Read the voltage value from the serial buffer
float voltage = voltageStr.toFloat();
if (voltage >= 0 && voltage < 0.2) { // Display the corresponding word based on the voltage value
display.println("MAGIQUE");
}
else if (voltage >= 0.3 && voltage < 0.7) {
display.println("POWER");
}
else if (voltage >= 0.8 && voltage < 0.2) {
display.println("POWER2");
}
else {
display.println("ERROR");
}
// Update the display
// display.clearDisplay();
}
}
I was inspired by this older post.
And here my connexions with pictures + drawing:
Dossier par défaut_20240427.pdf (301,4 Ko)
Thank you so much!
Best