Hot answers tagged

4

This is wrong in many ways: String input = Serial.readString(); serialInputBuffer = new char[input.length()]; input.toCharArray(serialInputBuffer, input.length()); What's fatal is that you later don't free the memory allocated with new. Don't use String and new. Both use heap memory and will fragment it with these small allocations until there is no space ...


3

The SSD1306 uses a lot of RAM. Pretty much all your RAM. Serial also uses quite a bit of RAM. The two struggle to work together. There is a special "text only" SSD1306 library that uses considerably less RAM: https://github.com/greiman/SSD1306Ascii


2

As Majenko already stated, the second image shows a custom display. It is not pixelated, because each shown element/symbol has it's own element in the LCD. When you have one of these displays, you might be able to reuse it for your project, but that is advanced. In the case of pixel based displays with a significantly higher resolution than the standard ...


2

Is the SPI communication method feasible? I have found a chip at present, and it seems that the driver can be transplanted directly. You can look at this chip. https://nl.mouser.com/ProductDetail/Newhaven-Display/NHD-169-BREAKOUT?qs=wnTfsH77Xs6v7mYjAGElxw%3D%3D


2

In the Adafruit_SH1106.h header file, SH1106_WHITE and SH1106_BLACK are defined simply as WHITE and BLACK respectively. So instead of writing SH1106_WHITE try replacing it WHITE and SH1106_BLACK as BLACK respectively. Eg:- fillRect(0, 0, 127 , 14, WHITE);


2

Most USB powerbanks will automatically turn off if there is not a minimum current draw to keep them turned on. The Arduino is obviously drawing current below the limit for the devices you have. A couple of options: Add some additional load to keep the powerbank on indefinitely. Of course this may waste power but that's part of the price to pay. Find a ...


2

Do not use String. Ever. Especially not on a chip with such a tiny amount of RAM. String uses dynamic allocation to store the string data in RAM. This is very inefficient, especially when you are working with string literals. Those literals must be stored in flash, not RAM, so you need to be working with const char * and PROGMEM, along with the F() macro. ...


2

Just guessing but looks to me like you read the CAN message and print it character by character to the Serial console but you don't save those characters in a buffer as you get them from CAN.read(). So when you then try to display.print((char)CAN.read()); at that point there are no more characters to available for the CAN.read() to read so nothing is printed ...


1

Mystery solved :) After some more reading it appears that the display driver is actually SH1106, so after using the right library I got the display working.


1

Your SPI is not setup for the Arduino UNO. Check another example for SPI and you will be using pins 11 and 13, this is mandatory and 8,9,10 or any three and there is a definition statement for these 3 pins - look at the example for your display. For I2C do you have pullup resistors on both I2C lines 4.7k up to 10k? These are required. Good luck


1

Thank you Majenko... It was low RAM problem. SSD1306 takes 1K, with MPU6050 the and serial print which I have included the remaining RAM is 5 bytes only, hence the initialization issue. I followed simple guideline to reduce RAM footprint Read this thread https://stackoverflow.com/questions/8649174/checking-memory-footprint-in-arduino Code to print available ...


1

This is a formal answer to the question based on the comments between Paulo Borges and Majenko. The ESP32 is dual core, meaning that it comes with 2 Xtensa LX6 32-bit microprocessors: core 0 and core 1. The issue is not a bug in your code but rather that you are running your threads on Core 0 instead of Core 1. In the ESP, the Core 0 is used for the RF ...


1

Currently, you defined a forward declaration for drawLine, however I assume you want to call the method (function) inside display. So change drawLine(20,60,5,50,256); into display.drawLine(20,60,5,50,256); And you can remove the forward declaration, because this method is already defined in the library. void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, ...


1

I do not understand, how you initialize the DHT sensor object. (I wonder why this compiles at all.) Your way: //dht11 kodu için ayarlamalar #include <dht.h> dht DHT; #define DHT11_PIN 7 I would use: //dht11 kodu için ayarlamalar #include <DHT.h> #define DHT11_PIN 7 DHT dht( DHT11_PIN, DHT11 ); Don't forget to start the DHT object with: void ...


1

Each instance of your class uses RAM to store its data. There is always a limit to the number of instances; not a fixed number, but a limit imposed by the quantity of RAM available. What Majenko wrote about Strings applies equally to class instances, if instances are constructed and destroyed during the run. A fixed number of global instances, as you have ...


1

NOTE: This refers to an problem in the initial posting. The question has since been edited. This may be deleted later. One problem, perhaps the problem, is that your given image appears to be 64x128 rather than 128x64: That said, I'm not sure exactly why the screen is showing precisely what it does. When you do get this showing in the correct resolution, ...


1

I had accidentally commented out the SD initialization along with the serial initialization. After uncommenting it it works correctly


1

I figured out what I was doing wrong. I was copying the name from the Constructor Reference and immediately inputting the arguments in parentheses. I needed to put u8g2 after the constructor name and then put the arguments. Thanks! The corrected code is as follows: #include <Arduino.h> #include <SPI.h> #include <U8g2lib.h> //Constructor ...


1

The SSD1306 does not handle different sizes, it's ever only handling it's maximum size 128x64. But one can decide to only use less pins of the driver for a smaller display. The SSD1306 has 128 segment pins, which activate the current column, so that the states of the 64 common signal pins will be used by the display for that column. For smaller display ...


1

Your initial code.txt file is flawed. The pdf file has the code in multiple columns on each page, and not all the columns are filled. This is the code (i think it is correct) Example of Initial Code Command(0x11); Data(0x00); Delay_ms(255); // Delay 255ms or more Command(0xC5); Data(0x01); Command(0xC4); Data(0x2F); Command(0xC0); Data(0x10); Data(...


1

The critical part, assuming your hardware works, is getting the software going. Not all OLEDs are the same, and different ones need different commands to get them working. You can't just take a random OLED and use a random library - it needs a driver to make it work. In this case it's the DA8620 that is the main chip that you want to worry about, and your ...


Only top voted, non community-wiki answers of a minimum length are eligible