#include <SparkFun_APDS9960.h>
#include "Wire.h"
#define INT_PIN // We'll connect the INT pin from our sensor to the
// INT0 interrupt pin on the Arduino.
bool lightIntHappened = false; // flag set in the interrupt to let the
// mainline code know that an interrupt occurred.
void setup()
{
//SerialUSB.begin(9600);
Wire.begin();
Serial.print("Starting");
Serial.println();
// APDS9301 sensor setup.
//apds.begin(0x39); // We're assuming you haven't changed the I2C
// address from the default by soldering the
// jumper on the back of the board.
//apds.setGain(APDS9301::LOW_GAIN); // Set the gain to low. Strictly
// speaking, this isn't necessary, as the gain
// defaults to low.
//apds.setIntegrationTime(APDS9301::INT_TIME_13_7_MS); // Set the
// integration time to the shortest interval.
// Again, not strictly necessary, as this is
// the default.
//apds.setLowThreshold(0); // Sets the low threshold to 0, effectively
// disabling the low side interrupt.
//apds.setHighThreshold(50); // Sets the high threshold to 500. This
// is an arbitrary number I pulled out of thin
// air for purposes of the example. When the CH0
// reading exceeds this level, an interrupt will
// be issued on the INT pin.
//apds.setCyclesForInterrupt(1); // A single reading in the threshold
// range will cause an interrupt to trigger.
//apds.enableInterrupt(APDS9301::INT_ON); // Enable the interrupt.
//apds.clearIntFlag();
// Interrupt setup
( pinMode.INT_PIN INPUT_PULLUP); // This pin must be a pullup or have
// a pullup resistor on it as the interrupt is a
// negative going open-collector type output.
attachInterrupt(digitalPinToInterrupt( ), lightInt, FALLING);
}
void loop()
{
Serial.print("Every second");
Serial.println();
delay(1000);
static unsigned long outLoopTimer = 1000;
//apds.clearIntFlag();
// This is a once-per-second timer that calculates and prints off
// the current lux reading.
if (millis() - outLoopTimer >= 1000)
{
outLoopTimer = millis();
//SerialUSB.print("Luminous flux: ");
//SerialUSB.println(apds.readLuxLevel(),6);
if (lightIntHappened)
{
//SerialUSB.println("Interrupt");
lightIntHappened = false;
}
}
}
void lightInt()
{
lightIntHappened = true;
}
That is my code and it keeps saying that it has an error compiling for board Arduino/Genuino Uno, and I have tried many things to solve this problem yet I cant seem to find a solution
Arduino: 1.6.11 (Windows 7), Board: "Arduino/Genuino Uno"
In file included from sketch\sketch_mar30a.ino.cpp:1:0:
D:\Arduino\sketch_mar30a\sketch_mar30a.ino: In function 'void setup()':
D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:45:22: error: expected unqualified-id before numeric constant
#define INPUT_PULLUP 0x2
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:44:20: note: in expansion of macro 'INPUT_PULLUP'
( pinMode.INT_PIN INPUT_PULLUP); // This pin must be a pullup or have
^
D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:45:22: error: expected ')' before numeric constant
#define INPUT_PULLUP 0x2
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:44:20: note: in expansion of macro 'INPUT_PULLUP'
( pinMode.INT_PIN INPUT_PULLUP); // This pin must be a pullup or have
^
In file included from D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:249:0,
from sketch\sketch_mar30a.ino.cpp:1:
D:\Arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:79:38: error: expected primary-expression before ')' token
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:48:19: note: in expansion of macro 'digitalPinToInterrupt'
attachInterrupt(digitalPinToInterrupt( ), lightInt, FALLING);
^
D:\Arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:79:54: error: expected primary-expression before ')' token
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:48:19: note: in expansion of macro 'digitalPinToInterrupt'
attachInterrupt(digitalPinToInterrupt( ), lightInt, FALLING);
^
exit status 1
Error compiling for board Arduino/Genuino Uno.
In file included from sketch\sketch_mar30a.ino.cpp:1:0:
D:\Arduino\sketch_mar30a\sketch_mar30a.ino: In function 'void setup()':
D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:45:22: error: expected unqualified-id before numeric constant
#define INPUT_PULLUP 0x2
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:44:20: note: in expansion of macro 'INPUT_PULLUP'
( pinMode.INT_PIN INPUT_PULLUP); // This pin must be a pullup or have
^
D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:45:22: error: expected ')' before numeric constant
#define INPUT_PULLUP 0x2
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:44:20: note: in expansion of macro 'INPUT_PULLUP'
( pinMode.INT_PIN INPUT_PULLUP); // This pin must be a pullup or have
^
In file included from D:\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:249:0,
from sketch\sketch_mar30a.ino.cpp:1:
D:\Arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:79:38: error: expected primary-expression before ')' token
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:48:19: note: in expansion of macro 'digitalPinToInterrupt'
attachInterrupt(digitalPinToInterrupt( ), lightInt, FALLING);
^
D:\Arduino\hardware\arduino\avr\variants\standard/pins_arduino.h:79:54: error: expected primary-expression before ')' token
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
D:\Arduino\sketch_mar30a\sketch_mar30a.ino:48:19: note: in expansion of macro 'digitalPinToInterrupt'
attachInterrupt(digitalPinToInterrupt( ), lightInt, FALLING);
^
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
And that is my error message