File component issue (Using Bluetooth, TinyDB to control a Plant watering system)

it might help to do some tutorials to learn the basics...

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

Taifun


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

Thanks I appreciate the suggestion. I am a more of a hands on with pictures type though. I know! Right?

So this is what I have come up with.

Save Block.pdf (870.2 KB)

Should work Right?

I wonder why you are pasting blocks in PDF format. By right-clicking on a block you can export the block as a PNG file and place it here.

Yes. You have saved the data to memory.

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks directly into the post...

To download the pdf file and open it to find the screenshot takes time, and most people will not do that...
Thank you.

Taifun


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

Yikes sorry I will try and do better!

:grin:

Now you need to read the data and assign to text boxes.

Right! Do you have a sample of that code I can rework by chance showing how to extract and put the info back into the text boxes?

I think this will do the trick but I can't find this one component "Set TextBox".Any Idea Patryk?

Thank you!

#Off topic
Only PNG not gif right

1 Like

Yeah. I read the topic about gif and I just got crazy.

1 Like

Am I missing something Patryk?

So I think I have finished the Bluetooth "Connect", Disconnect", File "Save ", "Get" portions of this App All that's left is the "Start Timer". Here is what I have for the "TimerScreen" and "File" Code.

All I need to do now is to create a simple loop that takes the info from the text box, start the clock, turn on the relay, create a loop that counts down that text box data, Disables the clock, turns off the relay, and repeats this procedure for all 14 text boxes in sequence. Sounds simple enough. I have this code but it's not working as expected. Just to turn on relay one time for the first text box.

Nope not that easy. Can you give me an idea why. I worked on this little piece of code all weekend.

Thanks

You fell into the trap of trying to loop your way out of a timing feature.
Screen Shot 2021-02-01 at 7.30.49 AM

Here's the background on why that won't work:

Here's an app sample that shows how to code the solution, using multiple deadline variables and a single Clock Timer event...

1 Like

Sorry about not replying to your latest entering on my issue. I was exposed to COVID and have been dealing with that for the last couple of weeks.This example you sent me is confusing to me. I don't see the correlation between the buttons and the clock. Is there another approach I should be looking at to achieve a series of sequential countdown events?

All I am trying to do is take the text from each text box in sequence count down the value in that text box. When it reaches zero, move the counter to the next ext box value and count down to zero, Then move to the next text box take that value and count down to zero, etc. In between the countdowns I will trigger an event that requires talking to a relay board to turn a 110VAC relay on or off depending on the requirement.

I have been screwing with this CLOCK component for over a month now between working on it and dealing with a COVID infection and so far I CAN NOT get it to work for a lack of understanding of how it functions, I have tried several different ways to get this to work with no success. I could rally use some help in resolving this issue as it is just a small portion of this project and the customer is getting a little impatient with me. Can anyone offer a working solution to this issue I am having

Timer is suppose to read the text boxes in sequence from left to right from top to bottom. I turns a relay on for whatever value is in the "ON/OFF" column for the specified seconds. It then turns the relay off for the specified seconds in the "DURATION" column. This cycle repeats until it completes all 7 rows. That's it! Seems simple enough right.

This is my latest attempt

No errors but it drops through the first 3 boxes and performs the last textbox in the group when the "START" button is pressed Ha! Ha! Ha!

Could really use some constructive help.

why do you set the clock 5 times to enabled = true?
does this make sense?
also how does your RelayOn procedure look like?
you also call it several times...

it is important to understand, that the processing does not magically stop after setting timerEnabled to true the first time... the program code just runs through...

are you already familiar with The model of event processing in App Inventor by Lyn?

what you have to do after your first process is finished, then start the second process... and after the second process is finished, then start the 3rd, etc.
see this example https://puravidaapps.com/filebyfile.php, which is using anynchronous processing, it is about downloading files, which is different... just try to understand the logic...

Taifun


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

Export your .aia file and upload it here.

Hi Taifun

Thanks for the response. Sorry if I seem a little off I am recovering from COVID and it messes with you brain. Can't smell, can't taste, and my brain function is off speech and thinking. They say it can last up to 6 weeks or may never come back in some cases.

  1. I just thought it made sense to do it that way because I do not understand completely how the CLOCK component works and I am an old school programmer from the 90's.

  1. Yes my mistake which I caught right after I posted this. When I Enable the CLOCK I want the relay either on or off depending on if I am running through a ON/OFF cycle or the DURATION between ON/OFF cycle.


3. So putting the "Clock.TimerEnable = False" in the Clock routine is not a good Idea?

  1. I am not at all familiar with Lyn model I will definitely check it out.

  2. Forgive me but I thought I was doing that. Old school when a Routine like a BUTTON.CLICK is called it runs through it in sequence. When a sub routine inside that routine was called it would jumps out do that routine then return to the first Routine at the next line. Am I wrong in thinking that way?

I will look at the two links you sent me. Hopefully it will give me so insite even with my scrambled brain function.

Thank you so much for your help Taifun.