Hola, espero que puedan ayudarme.
Para empezar tengo un motorreductor que debe encenderse por 3 segundos al presionar un botón (una sola vez, no mantenerse presionado durante ese tiempo), esto se tiene que controlar físicamente y a través de Arduino IoT Cloud y crear un historial de los momentos en los que se presiona el botón.
He estado buscando ejemplos y no he encontrado mucho de lo que busco y sinceramente no sé como programar el motor; seguí este [Tutorial](http://“IoT Cloud - Getting Started - Arduino Project Hub on a motor mkr” 1010&offset=3) y solo logré encender el led desde el dashboard y no físicamente, la conexión es correcta pero presiono el botón y no enciende el led, el historial aún no lo comienzo.
Este es el código
/*
Sketch generated by the Arduino IoT Cloud Thing "testThing"
https://create.arduino.cc/cloud/things/d276ab77-67cb-420b-9ea4-bd34cdf385d9
Arduino IoT Cloud Properties description
The following variables are automatically generated and updated when changes are made to the Thing properties
bool switchState;
int potentiometerValue;
bool ledState;
Properties 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 <FTDebouncer.h>
#define LED_PIN 2
#define BUTTON_PIN 5
FTDebouncer buttons;
void setup() {
pinMode(LED_PIN, OUTPUT);
buttons.addPin(BUTTON_PIN, LOW);
buttons.init();
/*
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 3
*/
setDebugMessageLevel(2);
// 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);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
}
void loop() {
buttons.update();
ArduinoCloud.update();
// Your code here
}
void onLightChange() {
digitalWrite(LED_PIN, light);
Serial.print("The light is ");
if (light) {
Serial.println("ON");
} else {
Serial.println("OFF");
}
}
void onPinActivated(int pinNr) {
// do something according to the _pinNR that is triggered. For instance:
Serial.println(pinNr);
toggle = !toggle;
}
void onPinDeactivated(int pinNr) {
// do something according to the _pinNR that is triggered. For instance:
Serial.println(pinNr);
}