greenhouse project on IOT cloud with stepper motor - problem with stepper motor


I started thi sproject where I have a green house and an arduino mkr1000, and I started to work on the IOT clound offered by arduino.
I have few sensors: two dht11 (one for inside and one for the outside).
Based on temperature and humidity I want to a small panel to open so the air can come inside from this window.
I have a nema 17 stepper motor for open and close this sliding panel and two end switched (1 for th eleft and 1 for the right) that are telling to the stepmotor when to stop.

I connect everyning but I have a small problem with the stepper motor. It si working with the sample code that that we can find in the sample folder (“stepper_onerevolution”) but with my code th stepper motor is not working, it is doing a weird noise. CAn you please look at my code and check if there is something wrong please.

#include “thingProperties.h”
#include <DHT.h>
#include <DHT_U.h>
#include <Stepper.h>

// DHT sensor library - Version: Latest

#define DHTPIN0 2 //dht int
#define DHTPIN1 4 // dht ext

#define WaterSolenoid1 3

int HumidityExt;

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

#define DHTTYPE DHT11


void setup() {

  • // Initialize serial and wait for port to open:*

  • // This delay gives the chance to wait for a Serial Monitor without blocking if none is found*

  • //delay(1500); *

  • // Defined in thingProperties.h*

  • initProperties();*

  • // Connect to Arduino IoT Cloud*

  • ArduinoCloud.begin(ArduinoIoTPreferredConnection);*

  • dht0.begin();*

  • dht1.begin();*

  • pinMode(A1,INPUT);*

  • pinMode(WaterSolenoid1, OUTPUT);*

  • digitalWrite(WaterSolenoid1, LOW);*

  • // set the speed at 60 rpm:*

  • myStepper.setSpeed(60);*

  • // initialize the serial port:*

_ /*_

  • The following function allows you to obtain more information*
  • related to the state of network and IoT Cloud connection and errors*
  • the higher number the more granular information you’ll get.*
  • The default is 0 (only errors).*
  • Maximum is 4*
    _ */_
  • setDebugMessageLevel(2);*
  • ArduinoCloud.printDebugInfo();*
  • Serial.begin(9600);*

void loop() {

  • ArduinoCloud.update();*
  • // Your code here *
    TempInt = dht0.readTemperature();
    HumidityInt = dht0.readHumidity();

TempExt = dht1.readTemperature();
HumidityExt = dht1.readHumidity();

LightInt = analogRead(A1);

digitalWrite(WaterSolenoid1, HIGH);

digitalWrite(WaterSolenoid1, LOW);

  • Serial.print("Temp Interna: ");*

  • Serial.print(TempInt);*

  • Serial.print(F(" Umidity interna:"));*

  • Serial.print(HumidityInt);*

  • Serial.print(F(" Luce"));*

  • Serial.print(LightInt);*

  • Serial.print(F(" Solenoide:"));*

  • Serial.print(WaterSolenoid1);*

  • Serial.print(F(" Umidità esterna:"));*

  • Serial.print(HumidityExt);*

  • // step one revolution in one direction:*

  • Serial.println(“clockwise”);*

  • myStepper.step(stepsPerRevolution);*

  • delay(500);*

  • // step one revolution in the other direction:*

  • Serial.println(“counterclockwise”);*

  • myStepper.step(-stepsPerRevolution);*

  • delay(500);*


void onTempIntChange() {


void onWaterSolenoid1Change() {

  • // Do something*


Why is so difficult to get an answer in the arduino forum? I'm in th wrong section? or my expectation are too high?