Here is my code
#include <Wire.h>
#include "SparkFunISL29125.h"
#include <Stepper.h>
SFE_ISL29125 RGB_sensor;
const int stepsPerRevolution = 12 ;
Stepper myStepper(stepsPerRevolution, 14, 12, 13, 15);
int stepCount = 0;
//Green
const byte ledg_gpio = 32;
//Blue
const byte ledb_gpio = 35;
void setup(){
//Initialize serial communication
Serial.begin(115200);
//Initialize ISl29125
RGB_sensor.init();
//Green LED
pinMode(ledg_gpio, OUTPUT);
//Blue LED
pinMode(ledb_gpio, OUTPUT);
}
void setZeroPostion(){
unsigned long previousMillis = 0;
const long interval = 1000;
unsigned long currentMillis = millis();
myStepper.setSpeed(500);
myStepper.step(1);
bool motor_state = true;
while (motor_state) {
unsigned int green = RGB_sensor.readGreen();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (green == 65535){
motor_state = false;
}
myStepper.step(0);
}
}
void loop(){
setZeroPosition();
}
And I got an error "a function-definition is not allowed here before '{' token" at void loop