Comments (5)
oled.tickerTick() returns how many strings are queued to be displayed. You can add another string when the return value is less than TICKER_QUEUE_DIM by calling oled.tickerText().
When the return value is zero, all strings have been displayed.
from ssd1306ascii.
/**
* @brief Advance ticker by one pixel.
*
* @param[in,out] state Ticker state.
* @return Number of entries in text pointer queue.
*/
int8_t tickerTick(TickerState* state);
I should add that return of -1 indicates an error.
from ssd1306ascii.
BG wrote: oled.tickerTick() returns how many strings are queued to be displayed. You can add another string when the return value is less than TICKER_QUEUE_DIM by calling oled.tickerText().
When the return value is zero, all strings have been displayed.
the below never printed.
Serial.println(" >>>>>> finished displaying all strings");
I never received a oled.tickerTick() of "0" Perhaps I'm doing something wrong or I misunderstood.
My Code:
// Simple Ticker demo for I2C 128x32 oled.
//
// oled.tickerTick() returns how many strings are queued to be displayed. You can add another string when the return value is less than TICKER_QUEUE_DIM by calling oled.tickerText().
// When the return value is zero, all strings have been displayed.
//
#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"
#define I2C_ADDRESS 0x3C
SSD1306AsciiWire oled;
// Ticker display
#define RTN_CHECK 1 // Try values of zero or one for RTN_CHECK.
#define numberLoops 3
#define tickerRate 50 // milliseconds
TickerState state; // Ticker state. Maintains text pointer queue and current ticker state.
const char* text[] = {
"Prog: blah blah v0.02 " // 26 char 26 x (8 + 3) = 286, close to the 289 we counted in the number of "false" loops.
}; // this is an array of pointers to the text.
uint32_t tickTime = 0;
int n = 0;
// Ticker display end
// Setup
void setup() {
Serial.begin(115200);
delay(1000);
Wire.begin();
Wire.setClock(400000L);
oled.begin(&Adafruit128x32, I2C_ADDRESS);
// Use <font>, field at row 2, mag2x, columns 16 through 100.
oled.tickerInit(&state, ZevvPeep8x16, 2, false, 16, 100);
oled.displayRemap (true);
// Try this for full screen width with set1X.
// oled.tickerInit(&state, Adafruit5x7, 2);
oled.clear();
}
//----------------------------- Main
void loop() {
if (tickTime <= millis()) {
tickTime = millis() + tickerRate;
// Should check for error. rtn < 0 indicates error, rtn of 0 indicates all strings have been displayed.
uint8_t rtn = oled.tickerTick(&state);
if (rtn == 0){
Serial.println(" finished displaying all strings");
}
if (rtn <= RTN_CHECK) { // rtb = false every loop except when 1st char of the message reaches the left edge
// Should check for error. Return of false indicates error.
oled.tickerText(&state, text[(n++)%3]);
Serial.println(".........................rtn test true");
}
else{
Serial.println("rtn test false ");
return;
}
}
} // -- end loop --
// -- eof --
from ssd1306ascii.
Yes you will never get return zero since you always queue another copy of the string here when rtn == 1.
if (rtn <= RTN_CHECK) { // rtb = false every loop except when 1st char of the message reaches the left edge
// Should check for error. Return of false indicates error.
oled.tickerText(&state, text[(n++)%3]); <<------ Causes another copy of your string to be queued when rtn == 1.
Serial.println(".........................rtn test true");
} else{
Serial.println("rtn test false "); <<----- This is not false it is more than one copy queued.
return;
}
from ssd1306ascii.
Got it :) Thanks
from ssd1306ascii.
Related Issues (20)
- When using a display with more than 64 pixels in the Y direction, the lcdHeight parameter is ignored. HOT 6
- Changing I2C pins HOT 1
- Arduino Pro Micro 32U4 and oled.clear(); HOT 1
- Some functions seem to need pixels as a parameter and not row/column character numbers? HOT 3
- Is there any function that returns data from the display? (to verify the display is somewhat functional in init) HOT 2
- Issues Initializing Multiple OLEDs HOT 4
- 1.3" SSH1106 Compatibility HOT 1
- How to make 3 lines of text as large as possible HOT 2
- Support for 0.42" OLED 72x40
- Limiting display decimals, float with 1 decimal, not 2, using oled.print HOT 10
- When using the ssd1306AvrI2c library, the avr hangs indefinitely HOT 4
- Is there interest in Supporting the ATTiny1614 et al?
- Display the character ° HOT 2
- ShutDown OLED 1306 HOT 2
- How much effort to add SH1107 support?
- 70x42 OLED ? HOT 8
- Begin() return error if OLED not connected/found. HOT 2
- Text height HOT 2
- Two oled 128x32 sharing the same address 0x3C connected to ESP32
- Compiling error with Arduino nano every (ATMega4809) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ssd1306ascii.