Good morning!
I have a greenhouse kit.
I have the following error when i import the ventilation template:
How can i do to overcome this error?
Thanks for all
Good morning!
I have a greenhouse kit.
I have the following error when i import the ventilation template:
How can i do to overcome this error?
Thanks for all
Hi @mrsketch. I apologize for the problem importing the template.
The problem is that the template's sketch code was written for use with an older version of the "Arduino_MKRIoTCarrier" library. Unfortunately there was a change in the recent release of this library that made it incompatible with the template's sketch code.
The template developers are aware of the problem, but haven't updated the sketch code yet. So at this time an older version of the "Arduino_MKRIoTCarrier" library must be used with the template.
I'll provide instructions you can follow to configure Arduino Cloud to use the compatible version of the library:
Now try importing the template once again. Hopefully this time it will work as expected.
Please let me know if you have any questions or problems while following those instructions.
In case you are curious to understand why this workaround solves the problem, I'll provide an explanation below. If you aren't interested in the boring details, feel free to skip reading the rest of the post:
By default, Arduino Cloud uses the latest available version of each library when compiling a sketch. As I mentioned above, the latest version (2.1.0) of the Arduino_MKRIoTCarrier is not compatible with the template's sketch code. So we must force Arduino Cloud to instead use the compatible previous version (2.0.4).
Arduino Cloud gives preference to any libraries you imported to your account over the pre-installed libraries. So by importing the compatible version 2.0.4 of the library to your account, it causes Arduino Cloud to use that version when compiling the template instead of the incompatible version 2.1.0 of the library as it did before you imported version 2.0.4 to your account.
A post was split to a new topic: Non risco a dare un comando alla ventola ed al tempo della ventola nel cruscotto
Good morning and thanks so much for your help.
Now with the 2.0.4 library I can import the model without errors.
In the dashboard I now see the temperature and humidity values detected by the BME680 sensor.
However, I have another problem: I am NOT able to give a command to the fan and the fan time in the dashboard.
Let me explain better: I make sure I am online then I go to the dashboard and turn on the fan switch, in the "things" I see that the "fan" variable changes from false to true but the fan does not activate and so does it's about fan time.
I have checked and uploaded the sketch several times but the behavior of the fan does not change.
If I understand correctly, when I turn on the fan switch in the dashboard, I should call the following function: void onFanChange();
and then execute the instructions:
void onFanChange() {
// Add your code here to act upon Fan change
// fan on
if(fan){
Motor.speed(MOTOR2, 100); //the speed of the fan can be controlled with values from 0 to 100
}
else {//fan off
Motor.stop(MOTOR2);
}
but nothing happens.
What could it be?
I hope I have been clear and thank you again for your help and the time you dedicate to me
Excellent progress!
This part of your statement is not correct:
I should call the following function:
void onFanChange();
"You" don't need to call the onFanChange
function. The function is automatically called by the ArduinoIoTLibrary whenever the value of the fan
IoT Variable is changed via the Widget on the Arduino Cloud dashboard.
The code looks fine, so it might be a hardware problem.
In order to troubleshoot the problem, please upload this simple test sketch to your Arduino Greenhouse Kit:
#include <Grove_I2C_Motor_Driver.h>
void setup() {
Motor.begin(0x0f);
}
void loop() {
Motor.speed(MOTOR2, 100);
delay(1000);
Motor.stop(MOTOR2);
delay(1000);
}
When that sketch is running on the Greenhouse Kit, do you see the motor that is connected to the M2 terminal on the Grove I2C Motor Driver module turning on and off at 0.5 Hz?
Good morning,
I apologize for the delay in replying.
When I enter the code you gave me, I see the motor connected to terminal M2 always turn on and never stop.
It would appear that the Motor.stop(MOTOR2);
statement is never executed.
What I should expect instead is that the motor starts turning clockwise with speed 100 for 1 second and the green LED is on for one second and then I should see the motor stop for 1 second and the green LED is off.
What happens in reality is that the motor starts and turns clockwise with speed 100 and the green LED is on without ever stopping.
I did other tests in which I entered a speed>0 and after 1 second I inserted speed<0 i.e. by entering the following code:`#include <Grove_I2C_Motor_Driver.h>
#define I2C_ADDRESS 0x0f
void setup() {
Motor.begin(I2C_ADDRESS);
}
void loop() {
Motor.speed(MOTOR2, 100);
delay(10000);
Motor.stop(MOTOR2);
delay(10000);
Motor.speed(MOTOR2, -100);
delay(10000);
Motor.stop(MOTOR2);
delay(10000);
}`
I noticed that it only executes the following 4 statements:Motor.speed(MOTOR2, 100); delay(10000);
and Motor.speed(MOTOR2, -100); delay(10000);
ignoring the stop instructions.
I noticed the following behavior in reality: motor on and running clockwise for 10 seconds with green LED on for 10 seconds and then green LED off and red LED on and motor turning counterclockwise for 10 seconds.
I hope I have been clear and the conclusion I make is that the stop function is probably ignored during program execution.
Thanks always for your time.
Great troubleshooting work!
From looking at the library's source code, I see that Motor.stop(MOTOR2)
is equivalent to Motor.speed(MOTOR2, 0)
:
What happens if you upload this sketch to your Greenhouse kit?:
#include <Grove_I2C_Motor_Driver.h>
void setup() {
Motor.begin(0x0f);
}
void loop() {
Motor.speed(MOTOR2, 100);
delay(1000);
Motor.speed(MOTOR2, 0);
delay(1000);
}
Good morning! I wanted to say that I am truly grateful for your help.
When I load the last given code, the engine in M2 continues to run without ever stopping.
However, I will do some more tests today, in the meantime, thank you
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.