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.begin();
display.fill(0x00);
display.setFixedFont(ssd1306xled_font6x8);
display.printFixed (0, 0, "How many turns. ", STYLE_NORMAL);
pinMode(input, INPUT);
}
void loop(){
if(digitalRead(input) > var)
{
var = 1;
pulse++;
display.printFixed (16, 16, pulse, STYLE_ITALIC); ???????? having problems with this line
}
if(digitalRead(input) == 0) {var = 0;}
delay(10); // Delay for stability.
}
]