Using switches to set a count value

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
Stagdriver
Posts: 3
Joined: Thu Oct 04, 2012 3:15 pm
Has thanked: 3 times
Contact:

Using switches to set a count value

Post by Stagdriver »

Hi i am new here and have spent the past few day creating a few theoretical projects to see how i get on with Flowcode, all good so far, money well spent i think. I have looke through much of the discussion and i feel i need a bit of catching up.

Now my first real project.
I am looking to be able to use three switches to set a value between 1 and 7 (proposing to use Ports A0,A1 and A2 presumably using a combination of 1,2and 4 to set a number up to 7 of the type 0-255) and then use this value to set a loop count between 1 and 7.

I think this is probably quite simple, but cannot currently see the wood for the trees.

I have managed to create the main sequence to intelligently share a smart motorcycle battery maintainer between 1 and 7 bikes in a correct manner that allows the charger to properly initialise at each 48 hour change-over but would like to refine the system to allow me to set the number of bikes by using the three switches rather than re-program the chip each time and hard setting the count value.

I would appreciate anyones help who can nudge me in the right direction

Best regards

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Using switches to set a count value

Post by Benj »

Hello,

Welcome to the forums. Please can you sign up and use the relevant topic for your version of Flowcode.

http://www.matrixmultimedia.com/forum_upgrades.php

or for the demo version.

http://www.matrixmultimedia.com/mmforum ... m.php?f=49

Here is a quick example written in v5.
LoopDemo.fcf
(6 KiB) Downloaded 415 times

Stagdriver
Posts: 3
Joined: Thu Oct 04, 2012 3:15 pm
Has thanked: 3 times
Contact:

Re: Using switches to set a count value

Post by Stagdriver »

Did not expect it to be just so easy to collect the count from the switches. I had been head scratching for hours, Many thanks for that.
Next step hardware
I can see the benefit of working through the tutorials though.
Many thanks again, i will properly register with version 5 just as soon as i receive my order bundle via Amazon.

Post Reply