i'm trying to use this sketch for radiation board
Quote:
// Threshold values for the led bar
#define TH1 75
#define TH2 150
#define TH3 400
#define TH4 600
#define TH5 900
// Conversion factor - CPM to uSV/h
#define CONV_FACTOR 0.008120
// Variables
int ledArray [] = {DIGITAL8,DIGITAL6,DIGITAL4,DIGITAL2,DIGITAL1};
long count = 0;
long timePrevious = 0;
long time = 0;
long timePreviousMeassure = 0;
float radiationValue = 0.0;
//uint8_t GEIGER_INT_PIN_MON = DIGITAL7;
void setup(){
PWR.setSensorPower(SENS_5V,SENS_ON);
PWR.setSensorPower(SENS_3V3,SENS_ON);
delay(1000);
// USB.begin();
// USB.println("Starting Waspmote...");
enableInterrupts(LAI_INT);
for (int i=0;i<5;i++){
pinMode(ledArray[i],OUTPUT);
}
}
void loop(){
// Power RTC
RTC.ON();
if( intFlag & LAI_INT){
countPulse();
intFlag &= ~(LAI_INT);
while(!digitalRead(GEIGER_INT_PIN_MON));
enableInterrupts(LAI_INT);
}
if (millis()-timePreviousMeassure > 10000){
radiationValue = 6.0*count * CONV_FACTOR;
timePreviousMeassure = millis();
Utils.float2String(radiationValue, radiationValue_str, 4);
sprintf(Data_To_Send, "cpm = %d, uSv/h = %s, ", 6*count, radiationValue_str, '\t','\n');
USB.print("cpm = ");
USB.print(6*count,DEC);
USB.print(" - ");
USB.print("uSv/h = ");
USB.println(radiationValue);
ledVar(6*count);
count = 0;
}
}
void countPulse(){
count++;
}
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);
}
}
}
but i find this error:
In function 'void loop()':
error: 'GEIGER_INT_PIN_MON' was not declared in this scope
where is the problem and is this a correct sketch to use radiation board?
Giulio