Hi !
Since a couple of days, I work on a counter Geiger for a shield arduino Nokia 5110 LCD. Until now, I didn't meet any problem, until I want to do a kind of horizontal diagram , which represents the ups and downs of the detected radioactivity.
Of course, so I wanted to use the formula myGLCD.drawRect, which is made possible by the library LCD5110_Graph.h. But then, even with this library installed and included in the code with #include,
the program shows me an error message saying :
exit status 1
'class LCD5110' has no member named 'drawRect'
It's been almost an hour since I want a solution , without success , hence my call for help .
I also beg your pardon in advance if the error is evident , I'm "only" 13 years old and very likely much less experienced than many of you. Sorry too for my bad english, I'm French and I already ask this on the French forum but anyone seems to know the answer
Thanks,
Fenrir06
#include <LCD5110_Basic.h>
#include <LCD5110_Graph.h>
// initialize the library with the numbers of the interface pins
LCD5110 myGLCD(7,6,5,3,4);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];
// Threshold values for the led bar
#define TH1 45
#define TH2 95
#define TH3 200
#define TH4 400
#define TH5 600
// Conversion factor - CPM to uSV/h
#define CONV_FACTOR 0.00812
// Variables
int ledArray [] = {10,11,12,13,9};
int geiger_input = 2;
long count = 0;
long countPerMinute = 0;
long timePrevious = 0;
long timePreviousMeassure = 0;
long time = 0;
long countPrevious = 0;
float radiationValue = 0.0;
void setup(){
myGLCD.InitLCD();
myGLCD.setContrast(70);
myGLCD.setFont(SmallFont);
pinMode(geiger_input, INPUT);
digitalWrite(geiger_input,LOW);
for (int i=0;i<5;i++){
pinMode(ledArray[i],OUTPUT);
}
myGLCD.setFont(SmallFont);
myGLCD.print("COMPTEUR", CENTER,15);
myGLCD.print("GEIGER", CENTER,25);
myGLCD.drawRect(0, 26, 56, 32);
delay(2000);
myGLCD.clrScr();
}
void loop(){
myGLCD.setFont(SmallFont);
myGLCD.print("CPM",62,10);
myGLCD.setFont(MediumNumbers);
myGLCD.printNumF(radiationValue, 4, LEFT, 20);
myGLCD.setFont(SmallFont);
myGLCD.print("uSv/h", 58, 32);
myGLCD.setFont(MediumNumbers);
myGLCD.printNumI(countPerMinute,LEFT,0);
attachInterrupt(0,countPulse,FALLING);
if (millis()-timePreviousMeassure > 10000){
countPerMinute = 6*count;
radiationValue = countPerMinute * CONV_FACTOR;
timePreviousMeassure = millis();
Serial.print("cpm = ");
Serial.print(countPerMinute,DEC);
Serial.print(" - ");
Serial.print("uSv/h = ");
Serial.println(radiationValue,4);
myGLCD.setFont(SmallFont);
myGLCD.print("CPM",62,10);
myGLCD.setFont(MediumNumbers);
myGLCD.printNumI(countPerMinute,LEFT,0);
myGLCD.printNumF(radiationValue, 4, LEFT, 20);
myGLCD.setFont(SmallFont);
myGLCD.print("uSv/h", 58, 32);
//led var setting
if(countPerMinute <= TH1) ledVar(0);
if((countPerMinute <= TH2)&&(countPerMinute>TH1)) ledVar(1);
if((countPerMinute <= TH3)&&(countPerMinute>TH2)) ledVar(2);
if((countPerMinute <= TH4)&&(countPerMinute>TH3)) ledVar(3);
if((countPerMinute <= TH5)&&(countPerMinute>TH4)) ledVar(4);
if(countPerMinute>TH5) ledVar(5);
count = 0;
}
}
void countPulse(){
detachInterrupt(0);
count++;
while(digitalRead(2)==0){
}
attachInterrupt(0,countPulse,FALLING);
}
void ledVar(int value){
if (value > 0){
for(int i=0;i<=value;i++){
digitalWrite(ledArray[i],HIGH);
}
for(int i=5;i>value;i--){
digitalWrite(ledArray[i],LOW);
}
}
else {
for(int i=5;i>=0;i--){
digitalWrite(ledArray[i],LOW);
}
}
}