Hi guys,
I’m new on forum and with Arduino I have a problem because I want to print in serial port in loop the value of humidity and temperature but I want to print temperature after reading left gesture from apds-9960 and humidity after right gesture. I made functions which are called out after reading for example left gesture and then I have printed temperature reading but I don’t have idea how to go back to gesture menu so for example if I give left gesture I want to print in loop temperature reading and if I give right gesture I want to print in loop humidity reading. Please forgive me my language and help because I’m just starting with learning C and Arduino. I attached my .ino file.
Best greetings

apds.ino (1 KB)

I attached my .ino file.

Why didn't you just post it so that everyone can see it?

Sorry, this is the code:

#include <Wire.h>
#include <SparkFun_APDS9960.h>
#include "DHT.h"

#define DHTPIN 11  //DHT Pin

#define DHTTYPE DHT11 //DHT type

#define APDS9960_INT    2  //apds-9960 interrupt pin

SparkFun_APDS9960 apds = SparkFun_APDS9960();

int isr_flag = 0;


void setup() {


pinMode(APDS9960_INT, INPUT);

attachInterrupt(0, interruptRoutine, FALLING);



void loop() {

if( isr_flag == 1 ) {
  isr_flag = 0;
  attachInterrupt(0, interruptRoutine, FALLING);

  switch ( apds.readGesture() ) 
    case DIR_RIGHT:
    case DIR_LEFT:



void interruptRoutine() {
isr_flag = 1;

//temperature print, how to go back to switch instruction if I move left gesture and show humidity ??
void temp()
float t = dht.readTemperature();  

//humidity print,how to go back to switch instruction if I move right gesture and show temperature ??
void wilg()
float h = dht.readHumidity(); 

Please help guys, anyone have some idea how to make this work?