-
Notifications
You must be signed in to change notification settings - Fork 131
SmartButton error #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks. There is an issue with the code generation. Will fix this ASAP. This is what the correct code should look like
|
I have fixed the issue. Please use the code generator again to generate the code. |
ERROR CODE
|
The Code you have posted does not seem to complete. |
Any update on this? |
Issue with the code generator has been fixed. It should generate the
correct callbacks now and should be able to compile.
When you press the smart button in the app, it would trigger the callback ‘onButtonPress’ in the sketch. You can add the code there to do what you want to do when the button is pressed
Need to take a look at what Udemy has done. Accepting local currency is a
nightmare because we don’t have a business registered everywhere in the world
…On Tue, 29 Apr 2025 at 6:15 PM nbctcp ***@***.***> wrote:
*nbctcp* left a comment (sinricpro/esp8266-esp32-sdk#426)
<#426 (comment)>
I have fixed the issue. Please use the code generator again to generate
the code.
Any update on this?
is SmartButton function same as physical push button?
I mean when I release it will off relay
If yes, I wanna buy few more devices
If possible, could you adding 1 more payment gateway which could pay in
local currency
Exactly like Udemy did
$ rate and fee are high, if paid using Asian currency
—
Reply to this email directly, view it on GitHub
<#426 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABZAZZWLHRPHE3VXJC2NDXD235NO3AVCNFSM6AAAAAB36KJOS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMZYGEZTEOJZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
almost perfect |
What are you trying to achieve? |
my brother in an island have diesel generator to generate electricity for the village |
So the sequence's are like this?
|
|
/* ... */
const int BTN_RUN = 16;
const int BTN_START = 17;
const unsigned long timerDuration = 1000; // 1 second
unsigned long timer = 0;
void startTimer() {
timer = millis();
}
void stopTimer() {
timer = 0;
}
void pressStartButton() {
Serial.println("Pressing Start Button");
digitalWrite(BTN_START, HIGH);
}
void releaseStartButton() {
Serial.println("Releasing Start Button");
digitalWrite(BTN_START, LOW);
}
void pressRunButton() {
Serial.println("Pressing Run Button");
digitalWrite(BTN_RUN, HIGH);
}
void releaseRunButton() {
Serial.println("Releasing Run Button");
digitalWrite(BTN_RUN, LOW);
}
bool timerIsRunning() {
return timer > 0;
}
void startGenerator() {
if (timerIsRunning()) return;
Serial.println("Starting Generator");
pressRunButton();
pressStartButton();
startTimer();
}
void stopGenerator() {
Serial.println("Stopping Generator");
releaseRunButton();
}
bool timerIsExpired() {
return (millis() - timer) >= timerDuration;
}
void handleTimer() {
if (timerIsRunning() && timerIsExpired()) {
Serial.println("Timer is expired");
releaseStartButton();
stopTimer();
}
}
bool onPowerState(const String& deviceId, bool& state) {
if (state) {
startGenerator();
} else {
stopGenerator();
}
return true;
}
/* ... */
void loop() {
SinricPro.handle();
handleTimer();
} startGenerator.mp4Wokwi-Example: |
tq its working |
Yes, it's one physical device - a power generator - which you can turn on and off. |
This issue has gone quiet. Spooky quiet. We currently close issues after 14 days of inactivity. It’s been at least 7 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder, the best way to fix this or any other problem is to provide a detailed error description including a serial log. Thanks for being a part of the SinricPro community! |
Hey again! It’s been 14 days since anything happened on this issue, so our friendly robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m |
HW INFO:
esp32c3
SW INFO
Scetch folder path
C:\Users\user1\Documents\Arduino\Sinric_SmartButton
library path
C:\Users\user1\Documents\Arduino\libraries\SmartButton\SmartButton.h
https://help.sinric.pro/pages/tutorials/custom-device-types/smart-button/push-button
I am trying to follow that doc then download
But when I upload using IDE 1.8.19
I got this error
?
tq
Sinric_SmartButton.ino
SmartButton.h
The text was updated successfully, but these errors were encountered: