this is the original circuit
but i don't have that lcd but i have an oled i2c 0.96 128x64
I did a code but the temperature and humidity came out as 0 and 0
At this point, then, you do not know if the original circuit will actually work or not. Just get the proper LCD and test the original circuit and when it works, begin to modify it. Never begin with an unknown and modify it and then try to debug it.
the original circuit works my class mate tried it and it work i can't buy for at least 3 weeks ( i live far from my university) that shipping cost to much ( i don't live in the usa))
the one that i post it is the modified version
this is the og code
/*--------------------------------------------------------
THDISP
======
This program receives the temperature and humidity from node
THSENSOR and displays on I2C LCD
Author: Dogan Ibrahim
File : THDISP
Date : December 2022
---------------------------------------------------------*/
#include <SPI.h>
#include <mcp2515.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define CS 10
int T, H;
struct can_frame MyMsg;
MCP2515 mcp2515(CS);
void setup()
{
SPI.begin();
mcp2515.reset();
mcp2515.setBitrate(CAN_500KBPS, MCP_8MHZ); // Config CAN bus
mcp2515.setNormalMode(); // Normal mode
lcd.init(); // Initialize LCD
lcd.backlight(); // Backlight ON
}
void loop()
{
if(mcp2515.readMessage(&MyMsg) == MCP2515::ERROR_OK)
{
T = MyMsg.data[0]; // Temperature
H = MyMsg.data[1]; // Humidity
lcd.clear(); // Clear LCD
lcd.setCursor(0, 0); // Cursor at 0,0
lcd.print(T); // Display T
lcd.print(" C"); // DIsplay C
lcd.setCursor(0, 1); // Cursor at 0,1
lcd.print(H); // Display H
lcd.print(" %"); // Display %
}
}
i only modified the receiver and i've trying to debug it all day and search about it but nothing some dicided to post here
Please, show us the code you're trying(was that it in your original post, or has it changed...), and the compiler output messages before upload, so we know how much memory is in use/available. I've used these OLEDs, along with other libraries, and on an Uno/Nano, it's tricky to get enough memory freed up to avoid crashes, so my first suspicion is, you're running out of memory. DO NOT simply say "there's enough, it says "less than 100%" " - show us the messages, as you're probably not aware of some subtle things that are in play.
never post a screen shot, it demonstrates you don't want us to import your code to our IDE for testing. Not helpful.
The compiler output can be exported for the forum with a simple button push, so... same same.
Now, about that compiler output for the receiver. It might appear that there's enough dynamic memory available, but you need to look at what the Adafruit library allocates when initializing - it may need a 1K buffer, or a 2K buffer, I don't know, and can't test because you didn't see fit to give us the code in a code block.
I'm out of time, others will have to follow up on this.
Good luck!
the codes didn't change so i didn't think i needed to rewrite them
i wrote them in th post
as for the screenshot i'm just used to screen shot it whenever someone ask for it i appologize
as for the buffer i'm gonna look more into it
If you comment out all the code for the OLED, does the sketch show the correct data in the serial monitor?
There are other OLED libraries that use less buffer space, such as U8g2 with a page buffer. If all you need is text, and no graphics or fancy fonts, then there are libraries that need no buffer for the display.
No need to apologize. The problem is fixed and you fixed it yourself. That is two thumbs up
We all have the same goal, to get your project working. Don't hesitate to ask if you have a new problem.