The displayed numbers needs to read from right to left ie start at 0.000 and increment to 0.001, 0.002 etc. The received pulses are stored in a variable from the rotary sensor on the milling machine as the table is moved and continue incrementing, a final reading may be 2.237 . The is number is processed and displayed. When the table is moved the other way the variable will decrement and the reading may go to say -1.336 depending on when the table ends up.
This is the display part of the code from the dro sketch.
Code: Select all
tmp = encoder0Pos / Slots * Mpitch;
lcd.setCursor(0,1);
lcd.print(tmp,3);
lcd.print(" mm");
I tried adding some pics to help my description but failed miserable due to my lack of knowledge, sorry, need to do more reading!
Code: Select all
#include <HCMAX7219.h>
#include <HCMAX7219.h>
#include "SPI.h
#define LOAD 10
HCMAX7219 HCMAX7219(LOAD);
int count;
void setup()
{
HCMAX7219.Init();
HCMAX7219.Clear();
Serial.begin(9600);
}
void loop()
{
count ++;
delay (1000);
Serial.println(count);
float Number = count;
byte DecimalPlaces = 3;
byte NumberOfDigits = 8;
byte Offset = 8;
HCMAX7219.print7Seg(Number, DecimalPlaces, NumberOfDigits, Offset);
HCMAX7219.Refresh();
}