Apply Iteration On The Each Element In The Vector With A Time Delay
I have a vector having 8 elements , i want each element ot be itertated from initial state "30.9" and after every 1 second it is changed from 0 to 10 and soo on till 100 step by step , after it reach 100 then iteration moves to the second element "30.9" makes it 0 and then increase 10 value per second reaches highes to 100 and then back to initial condition.
hb = [30.9, 30.9, 33.9, 41.6, 46.6, 54.4, 59.2, 65.6] counter = 1 multiplier = 1 for i in range(1,9): Application.Variables['P():///Constant'+str(i)+'/Value'].ValueConverted = hb[counter] multiplier = multiplier + 1 counter = counter + 1
My attempt using the time module and a nested for loop. The time module allows you to use time.sleep(), which will wait for a specified number of seconds. I also changed the range from 1,11, since that will allow for 10 iterations, as range iterates from the starting element to the end element-1.
import time hb = [30.9, 30.9, 33.9, 41.6, 46.6, 54.4, 59.2, 65.6] counter = 1 multiplier = 1 for element in hb: print("Currently processing element: ", element) #Reset counter and multiplier after each loop counter = 1 multiplier =1 for i in range(1,11): #Do processing here multiplier = multiplier + 1 counter = counter + 1 time.sleep(1)
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module