Search code examples
arduinoaccelerometer

how to rectify the error "exit status 1 exponent has no digits" in arduino programming?


i need help in debugging an arduino program that i just typed. the error shown is:- 1.exit status 1 exponent has no digits ( found on line "char INT_ENABLE = 0*2E" ). the intention of the program is to set off a buzzer and turn off a relay switch when inactivity is sensed through adxl345 and do the opposite when activity is sensed. i am providing my program code below. have a check and help me in rectifying this problem and any other problem that you may find with my program.

#include <SPI.h>
int cs = 10;
int intr = 2;
int buzzer = 4;
int relay = 5;
int su = 1;
int intr1
pinmode (buzzer,OUTPUT);
pinmode (relay,OUTPUT);
char POWER_CLT = 0*2D
char DATA_FORMAT = 0*31
char DATAX0 = 0*32
char DATAX1 = 0*33
char DATAY0 = 0*34
char DATAY1 = 0*35
char DATAZ0 = 0*36
char DATAZ1 = 0*37
char THRESH_ACT = 0*24
char THRESH_INACT = 0*38
char TIME_INACT = 0*26
char INT_ENABLE = 0*2E
char INT_MAP = 0*2F
char ACT_INACT_CTL = 0*27
char INT_SOURCE = 0*30

char values[10];
char output[20];
int x, y, z;
char inactivityevent = 0;
void setup()
{
  SPI.begin();
  SPI.setDataMode(SPI_MODE3);
  Serial.begin(9600);
  pinMode(cs,OUTPUT);
  digitalWrite(cs, HIGH);
  attachInterrupt(digitalpintointerrupt(intr),interruptHandler,RISING); 
  writeRegister(DATA_FORMAT,0*01);
  writeRegister(POWER_CTL,0*08);
  writeRegister(INT_MAP,0*F7 && 0*EF);
  writeRegister(THRESH_INACT,1);
  writeRegister(TIME_INACT,0);
  writeRegister(ACT_INACT_CTL,0*0F);
  writeRegister(INT_ENABLE,0*08);
  readRegister(INT_SOURCE,1,VALUES);
} 

void interrupHandler()
{
  read register (INT_SOURCE,1,values);
}

void loop() 
{
 intr1=digitalread(intr);  
 if ( intr1==high)
  { 
   read register(DATAX0,6,values);
   x = ((int)values[1]<<8|(int)values[0]);
   y = ((int)values[3]<<8|(int)values[2]);
   z = ((int)values[5]<<8|(int)values[4]);
   if ( x<=15 && x>=-15 && y<=10 && y>=-10 && z>=75 && z<=90)
    {
     digitalwrite(buzzer,HIGH);
     digitalwrite(relay,LOW);
    }
   else
    {
     for (int i=0;i<=90;i++)
      {
       delay (2000);
       if (intr == LOW)
        { break(); }
       if (i==90)
        digitalwrite(relay,LOW);       
      }
    }
  while (su=1)
   {  
    if (intr==LOW)
     {
      digitalwrite(buzzer,LOW);
      digitalwrite(relay,HIGH);
      break(); 
     }
   }       
 }
}


Solution

  • For all the 0*nn values in the program, replace them with 0xnn. Make sure each line finishes with a semicolon (e.g., lines 7, 10-24). On line 40, check the expression containing && because that's a "logical" operator and you look like you want a "bitwise" operator there, so change && to &. In line 45, I think you need VALUES to be lower case, because the name of the variable you are trying to fill in is lower case.
    There are a couple of places you say read register but I think you need to use readRegister for those. Check line 78, which has the while loop checking the value of su. I think you should have while (su == 1) here instead of just one =. The single = is setting the value, but I think you want to check the value instead, hence you need ==. I do note that there's nothing in the program to change su from 1, so it will go on forever until the intr happens.