Having a little problem with printing to LCD

Hi all. It's been forever since i've been on here, or have worked with arduino and i'm trying to refresh myself on how things work.

I have to wrap a couple transformer coils and am making a counter with a magnet and an analog sensor and let the arduino keep count for me, and display it on a small LCD screen. it works fine with serial print, but i need it mobile without a computer attached...

The counting part works fine, but i'm having problems getting it to print on the mini LCD screen, and my experience is extremely limited when it comes to graphics. but i am getting random images and symbols instead of numbers. And i can't figure out what is going on.

below is the code i wrote, borrowed and modified. originally this arduino was used as a frequency generator with a LCD and rotary. I just deleted the rotary, and changed what i needed. but the previous program was complicated and can't remember how to use the LCD library for commands... and all of the examples for it are graphics based, so i'm lost.
#include "lcdgfx.h"

const byte input = 9;
long int pulse = 0;
int var = 0;

DisplaySSD1306_128x32_I2C display(-1); // Use this line for Atmega328p (3=RST, 4=CE, 5=D/C)

void setup()
display.printFixed (0, 0, "How many turns. ", STYLE_NORMAL);

pinMode(input, INPUT);


void loop(){

if(digitalRead(input) > var)
var = 1;

display.printFixed (16, 16, pulse, STYLE_ITALIC); ???????? having problems with this line

if(digitalRead(input) == 0) {var = 0;}

delay(10); // Delay for stability.

'tis better in a problem to just set the count to a fixed number, say 999 and then in loop only display it to get the syntax correct inside the parentheses. After thar, add the counting stuff.

I don't have your library, but generally, libraries come with some documentation and a few examples that are supposed to show how everything works. If you can't find any text-related examples, try looking directly into the header file for function declarations: they should at least be briefly commented to explain what they expect. If they aren't, try to figure it out based on the arguments they take. Or switch to another library, even; there are plenty for graphical displays.

I found out what my problem is, but i haven't had the time to attempt to fix it. The LED display i was using is a small graphics color display. so i can't just print numbers or letters that's in a loop. having something fixed on the screen is easy, but if i need it to display and update a number. i have to use the (char) function. and i'm not familiar with that very much.

so for the meantime. i was able to download an arduino app on my tablet and just keep it hooked up to the arduino while i'm using it..... which for the moment, is working good. But in the future i'll have to fix it right.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.