BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blank time input widget with Arduino

Hello,
I have a problem with using the input widget .
My hardware ist arduino mega
Iphone SE, newest IOS

When I use the sketch “update time input state on IU” it is not possible to work with integer variables like below in the sketch I become the following response :

/var/folders/g6/_qgcfz5n353c8qc0h1w4pgyh0000gp/T/arduino_modified_sketch_804163/UpdateTimeInputState.ino:58:30: warning: integer overflow in expression [-Woverflow]
*** unsigned long stopAt (60060); //01:05**

Whats wrong in the sketch ? Is it because Arduino mega has only a 8 Bit CPU ?

Thanks for help.

[Unformatted code removed by moderator]

Before creating the topic

  1. Search forum for similar topics
  2. Check http://docs.blynk.cc and http://help.blynk.cc/
  3. Add details :
    • Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
    • Smartphone OS (iOS or Android) + version
    • Blynk server or local server
    • Blynk Library version
    • Add your sketch code. :point_up:Code should be formatted as example below.

Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.


void loop()

p.s. its the same problem when using variables like :

[Unformatted code removed by moderator]

it only works by using directly an item like this for example:

[Unformatted code removed by moderator]

@alphakasi please edit your posts, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Continuing the discussion from Blank time input widget with Arduino:

It’s much simpler, and tidier, if you EDIT your existing pists to fix the formatting, rather than simply re-posting your formatted code in another post.
I have deleted your unformatted code from your previous posts.

You seem to be missing an equals operator (=)

If you add that in like this I think it should work…

unsigned long stopAt = (600*60);

Some of your in-code comments are rather confusing, such as this:

If you want something to run automatically when Blynk connects then you should use the BLYNK_CONNECTED callback function. The BLYNK_WRITE(V46) callback will only be triggered when the value of the widget attached to V46 changes, or if you call Blynk.syncVirtual(V46) which is usually done from within BLYNK_CONNECTED

= 00:04 not 00:05

= 10:00 not 01:05

Also, you seem to be using the widget time input widget in reverse - pushing the values from the code rather than allowing the user to set them in the app.

Pete.

Thank you but the “=” is not the Problem. In C++ its possible to write the operator directly behind without using “=”.
But I changed the code

unsigned long   stopAt = (600*60); 

When testing the code offline its the same failure :slight_smile:
warning: integer overflow in expression [-Woverflow]

  • unsigned long stopAt = (60060);

If you google the error message it seems that the 600*60 calculation is being treated as an integer during the intermediate calculation, as you’re multiplying two integers together.

Maybe (600L*60L) would solve the problem?

Pete.

I changed the code as you told me and : it works, offline tested… no failure !

When I am at home today I will do the same online and look what happens.

Thank you for helping me!