- Wed Nov 11, 2015 7:40 am
#185804
Hi,
I make a litle program with the Timerone library (http://www.prometec.net/wp-content/uplo ... merOne.zip) but the Microview don't display nothing
I know there are some incompatibilities when interrupts are used, this will be a case?
#include <TimerOne.h>
#include <MicroView.h>
#define myDir 3 // Direction
#define myStep 4 // Step
int paso = LOW;
int m, mu=0,md=0;
int s, su=0,sd=0;
int l, lu=0,ld=0,lc=0;
volatile float angulo = 0;
volatile long tiempo = 0;
float A;
long N;
void setup() {
uView.begin();// begin of MicroView
uView.clear(ALL); // erase hardware memory inside the OLED controller
uView.display(); // display the content in the buffer memory, by default it is the MicroView logo
uView.clear(PAGE);
digitalWrite(myDir, 0 );
Timer1.initialize(67839);
Timer1.attachInterrupt(anticlockwise);
}
void anticlockwise() {
paso!=paso;
digitalWrite(myStep, paso );
angulo=angulo + 0.0002826633165;
tiempo=tiempo + 68;
}
void loop() {
noInterrupts();
N = tiempo;
A=angulo;
interrupts();
uView.setFontType(0);
uView.setCursor(0,0);
uView.print(A);
uView.setCursor(0,8);
uView.print(N);
}
I make a litle program with the Timerone library (http://www.prometec.net/wp-content/uplo ... merOne.zip) but the Microview don't display nothing
I know there are some incompatibilities when interrupts are used, this will be a case?
#include <TimerOne.h>
#include <MicroView.h>
#define myDir 3 // Direction
#define myStep 4 // Step
int paso = LOW;
int m, mu=0,md=0;
int s, su=0,sd=0;
int l, lu=0,ld=0,lc=0;
volatile float angulo = 0;
volatile long tiempo = 0;
float A;
long N;
void setup() {
uView.begin();// begin of MicroView
uView.clear(ALL); // erase hardware memory inside the OLED controller
uView.display(); // display the content in the buffer memory, by default it is the MicroView logo
uView.clear(PAGE);
digitalWrite(myDir, 0 );
Timer1.initialize(67839);
Timer1.attachInterrupt(anticlockwise);
}
void anticlockwise() {
paso!=paso;
digitalWrite(myStep, paso );
angulo=angulo + 0.0002826633165;
tiempo=tiempo + 68;
}
void loop() {
noInterrupts();
N = tiempo;
A=angulo;
interrupts();
uView.setFontType(0);
uView.setCursor(0,0);
uView.print(A);
uView.setCursor(0,8);
uView.print(N);
}