Escolar Documentos
Profissional Documentos
Cultura Documentos
#include <DigoleSerial.h>
//--------UART setup
#if defined(_Digole_Serial_UART_)
DigoleSerialDisp mydisp(&Serial, 38400); //UART:Arduino UNO: Pin 1(TX)on arduino to
RX on module
#endif
//--------I2C setup
#if defined(_Digole_Serial_I2C_)
#include <Bounce.h>
#include <Wire.h>
DigoleSerialDisp mydisp(&Wire, '\x27'); //I2C:Arduino UNO: SDA (data line) is on
analog input pin 4, and SCL (clock line) is on analog input pin 5 on UNO and
Duemilanove
#endif
//--------SPI setup
#if defined(_Digole_Serial_SPI_)
DigoleSerialDisp mydisp(8, 9, 10, 11); //SPI:Pin 8: data, 9:clock, 10: SS, 11:SI.
you can assign 255 to SS, and hard ground SS pin on module
#endif
int Sensor=0;
int BotaoMais =0;
int BotaoMenos =0;
int Reset =0;
unsigned char i;
int c,d;
void setup() {
/****************************
* Zerando contadores
***************************/
Contador == 0;
ContadorTotal ==0;
Aux ==0;
Temp1 ==0;
Temp2 ==0;
Temp3 ==0;
/***************************
*
*/
pinMode(BotaoMais1, INPUT);
pinMode(BotaoMenos1, INPUT);
pinMode(Reset1, INPUT);
}
delay(1000);
mydisp.setRotation(0); //change screen direction to 1, screen width and screen
height exchanged
mydisp.setDrawWindow(DW_X, DW_Y, DW_W, DW_H); //set a draw window left/top:5,8,
Height=LCDHeight-15, width=LCDWidth-10
mydisp.setColor(255);
unsigned char j=0;
void loop() {
Sensor=digitalRead(Sensor1);
BotaoMais=digitalRead(BotaoMais1);
BotaoMenos=digitalRead(BotaoMenos1);
Reset=digitalRead(Reset1);
if (Sensor == HIGH) {
delay(100);
Aux = Aux + Sensor;
Contador = Contador + Sensor;
ContadorTotal = ContadorTotal + Sensor;
if (Aux > 49 ) {
Aux=0;
Contador=0;
mydisp.clearScreen();
Temp2 ==0;
Contador ==0;
ContadorTotal ==0;
mydisp.setRotation(Contador % 8);
mydisp.drawStr(0, 1, "PARCIAL=");
mydisp.print(Contador);
mydisp.setRotation(ContadorTotal % 8);
mydisp.drawStr(0, 0, "TOTAL DIA=");
mydisp.print(ContadorTotal);
delay(100);