How do you delay in blocks?

Hi all.
how to put delay in blocks it can just delay the location that need delay?
not like put a clock and do thing later.

You use a clock timer and do things later.

Show what it is you want to do.

1 Like

Thanks.
I asked so because when I call the ProCamBase64.TakePicture right after BLE meg received, I got lot of black screen pictures saved in the forlder, I guess it is because call too soon, and may need a timer for camera to fire? but if I set timer and then use a clock to call, it never fired. don't know why?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

Sure.
here attached the blocks. which simply used ESP32 BLE to send 'TAKE_PICTURE' to APP and let the APP to trig ProCamBase64.TakePicture.
The receiver is OK, and what happened as above explained.
fiirst this one, not only the Cam.. not fire, even the Label3 doesn't show.
VV1

BLOCK:

THE APP:
QuickProCamToImage_BLE6_ll_GPT.aia (246.1 KB)

THANKS.

If Clock3 isn't firing

image

then you need to debug here:

Also should it be screenshot1234 ? (and not screeshot1234)

1 Like

Thanks.
you are right, it should be "screenshot1234".
the Label1 shown "false" may cause of the missing 'n' ?
did debug:
the Label2 shown 'takePP'.

edited: set.Clock3.TimerInterVal to 50, clock3 work now, it was set 200 - 1000, maybe too long?

the saved pictures still got black screen, why so? and only saved at APP first run, if restarted APP no picture taken by BLE.

That is what we are asking you!

Debug the blocks in the StringsRecieved event...

1 Like

thanks.

edited: set.Clock3.TimerInterVal to 50, clock3 work now, it was set 200 - 1000, maybe too long?

the saved pictures still got black screen, why so? and only saved at APP first run, if restarted APP no picture taken by BLE.

the Label3 shown means stringReceived is run good? ESP32 only send 'TAKE_PICTURE'.

or can you tell where should modify, thanks.

Try a simple test project to take an picture on button click

Taifun

1 Like

you need to take next photo in the photo taken finish event, not in a timer to call it every 50ms.

thanks.
the buttons work well: take picture, ini camera, close camera, save picture, and repeat operating these all good.

even set the button trig timer and use clock to tirg cam take picture all goog, but BLE trig not work, why?

ont thing is I set.clock3.timerenable to false at front of screen.initialize, if remove it the clock fire at APP start.

unchecked the : clock3 TimerAlwaysFires, clock still fire as APP run. how to set clock false?

uncheck TimerEnabled in the Designer

Check TimerAlwaysFires

1 Like

A few things I would change/simplify in your blocks

  • Initialize the camera in event Screen.Initialize abd remove Button1.Click event
  • Which Android version are you using for your tests? Remove asking for write external storage permission
  • write a procedure to set the camera output and to take the picture and call that procedure from event StringReceived and Button3.Click
  • There is no clock necessary to take the picture, remove Clock2 and Clock3

Try this and if you still have issues, post an updated screenshot of your relevant blocks.

Taifun

1 Like

uncheck TimerEnabled in the Designer

Check TimerAlwaysFires

did, still only set time=50 clock3 fire, but not take picture, other set not even fire.

Thanks.
my phone Android 5.0;
midified the block. got picture taken, still got lot of black screen pictures say: 727
the 1 picture I like to take got 11 same pictures;

nn

BLOCK:

AIA:
QuickProCamToImage_BLE6_ll_GPT (1).aia (244.8 KB)

You have a procedure named getASD, which does not provide the path to ASD, but to shared storage, that's ok if you want to store it rhere, only the name of the procedure is confusing

My guess is, you are sending the text TAKE_PICTURE via BLE 11 times and this goes so fast, that the process of taking a picture is still in progress while you are already trying to take the 2nd, 3rd, 4th etc
To solve this, add a global variable let's call it takingPicture and set it to true before taking the picture
In event SavedPhoto set it to false again
Also take the picture only if takingPicture is false

Taifun

1 Like

Thanks.

there is 1 picture taken 10 pictures and lot of black after set the takingPicture, did I made some thing no right?

do I need modify the procedure of getASD, I like to have pictures saved in picture folder. its ok even without extenal storage permission requested.

can the APP check the last char of string?

Add an and to check additionally

And as mentioned earlier

Taifun

1 Like

Thanks.
got improved.

this block take just one picture.
APP crashed after taken