Hi everyone, I am trying to take my project in arduino uno to the IOT, the thing is in my code, the physical one, everything is ok. the push button works fine with the INPUT_PULLUP pin thing... but when I take it to the IOT, I can not edit the button to be an INPUT_PULLUP like in the UNO.
I have tried many things but no consistent result.
does enyone know how to make the push button work correctly in IOT when you need to results when you push it?. one push it goes one turn clockwise, next push goes counter clockwise and so on...
here is my code if its a matter of coding.... the variable I used is boolean read write on change...
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled 2"
https://create.arduino.cc/cloud/things/6be332f7-5ee9-4bb7-a7c2-751e9f71c806
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
bool stepper_01;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include <Stepper.h>
int stepsPerRevolution = 2048;
int motSpeed = 10;
int dt = 500;
int motDir = 1;
Stepper myStepper(stepsPerRevolution, 16, 17, 5, 18);
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
myStepper.setSpeed(motSpeed);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
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();
}
void loop() {
ArduinoCloud.update();
// Your code here
}
/*
Since Stepper01 is READ_WRITE variable, onStepper01Change() is
executed every time a new value is received from IoT Cloud.
*/
void onStepper01Change() {
if (stepper_01 == HIGH) {
if ( motDir == 1) {
myStepper.step(stepsPerRevolution);
motDir = 0;
} else {
myStepper.step(-stepsPerRevolution);
motDir = 1;
delay(500);
}
}
}