Making a delay based flashlight, what am I doing wrong here?

Hi, I'm trying to make a small Li-Fi app. To transfer time with it. so far I was able to get the system time convert it to seconds and store it into a list in binary format. now what I'm trying to do is to read the list and if the value was 1 turn on the flash ligh for 500milis and if it was 0 turn of the flash light for 500 milis. I'm using this extention to handle delay. but the app dose not react like i want. when i click on the button it just flashes 2-3 time adn it goes of and some times it just stays on. here are my block. tnx in advance.

[mod edit - foul language removed from first image, please be careful when posting images]

This is probably your issue.

The model of event processing in App Inventor

Use a clock timer, and move the relevant blocks into it, which will handle the "delay"

Plus, you call flashlight off for both your if conditions

A simple example:

flashonandoff.aia (2.6 KB)

1 Like

Search this board for Morse code samples

1 Like

So far i was able to make a simple flasher :smiley:
but there is a problem! I want to make my flash on and off for 61 time, but i only can count exacly 31 time. my timer intervals is 500 milis. what i'm doing wrong here? :face_with_head_bandage:



Try following the blocks / aia project I provided

Something like this:

If you want 61 full cycles, (61 on and 61 off) , that's 122 transitions between on and off.

I have a list of 1's and 0's the lenght of the list is 31, my goal is two write a program that when i read each index of the list if it's a 1 turn on the flash for some miliseconds also when the index is 0 keep the flash off for the same amout of time. and so far i have this.
my timer for button 3



button 2 for making the list

I successfully made the list and it's working as expexted but what trubles me is that I can't understand the mechanism of delay made by clock! I have been scratching my head for two days now! but I'm stuck in the delay! and I need help! :weary:
my project
lifi.aia (29.7 KB)

that was my mistake! I made it work, I can turn on and off the flasher for the specific period and times but! I cant make it on and off according to 1's and 0's in my list!

See this sample for some list management code ...

1 Like

You moved the goalposts :slight_smile:

1 Like