Hello, I'm new on arduino. I've created board to get distance and display it on OLED (SH1106).
First method, I'm using :
1 Arduino Nano - 1 TCA9548A (i2C) - 3 TOF10120 Sensors (on channel 4, 5, 6) and 3 1.3" OLED SH1106 (on channel 0, 1, 2) and a push button to switch display on each OLED. But this schematic consume high memory, about 83% - using U8g2 lib. And the result is sometimes OLED not display anything till I pressed reset button few times and lagging if I push the button for switch display result.
Arduino 1 send data from 3 sensors using i2C comm to Arduino 2 and Arduino 2 display the data on OLED, so each arduino have connection on pin A4 (SDA) and A5 (SCL) with Multiplexer and to another arduino.
The goal is to reduce each arduino memory, now I got about 50% memory only for each Arduino. But I'm facing a problem that sometimes OLED not display anything (black) - I dont know if there was error on bread board or not.
So, the questions :
Is my scenario to split and communicate data-display between 2 arduino is visible? because I'm still using only 1 sensors to trial (2 sensors are dead because over voltage on another trial scenario)
What factor do I must concern for displaying via OLED SH1106 via U8g2 lib because sometimes works well but if the arduino is turned off and on again, the display is black and not working even I pressed the reset button
Most beginners go for a multi processor system when they run out of memory but there are many ways of reducing memory usage. The biggest one being is to use the U8g2 lib a bit more smartly, and split the display buffer into a quarter of the size and then have four writes to make a full screen display. Details of how to do this are in the library documentation and examples.
Next all literal strings, things in quote marks, take up program memory, look up the Arduino’s F macro to see how to cut down on the memory that takes.
Then see if you can save some bytes by making variables that only hold small numbers into byte types instead of ints.
Click on the File Menu, select the Examples option, scroll down until you see the u8g2 folder, follow the link to "full buffer" and then again to UpdateArea. This example shows you how to use
U8g2lib Example Overview:
Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.