# Csgo Game For Airsoft

Sep 5, 2018

### Thing Apps Enabled

Hi NightfuryGamer

I had a thought about using a POT to adjust the game time. its been a long time since i did any programming so i wanted to run this past you.

Using the analogRead function I can get a INT ranging from 0 - 1023 , so im thinking about reading the analog signal and then times it by 10 to get the value for the timer in seconds.

01 x 10 = 100seconds which is 1.6min game time
10 x 10 = 1000 seconds which is 16.6min game time

The problem i having is the most games are going to be around 15 to 30 min so id rather use the whole POT range over say 1min to 60min but i cant get my head around how to do that. do you have any suggestions?

-Update-
My current thought is to times by 3.5 then use the value as seconds.

-1 hour is 3600 seconds
-the pot reads to a max of 1024

So 3600 / 1024 is 3.51

POT at 100% would read 1024 x 3.5 = 3584 seconds (59.73 min)
POT at 50% would read 512 x 3.5 = 1792 seconds (29.86 min)

This leaves a dead spot at the 0% mark on the dial. Im thinking of just doing a dirty if statement that makes the min time 5 min to avoid the INT being zero.

many thanks
Ratman99UK

I have no idea why you would want to do all this over complicated work...... the timer is already preset to 30 mins and can be adjusted by going into the code and just changing the ExplosiveTimer variable. it is in seconds so if you make the variable 300 it will last five minutes and 60 will last one minute so on so forth. Maybe there is something i'm not understanding here bc i am not the greatest coder but from what i understand you are trying to make it have varying time amount, and that i already did

Hi Nightfury

We want to use it for nerf wars with children and adults. So for example I want to be able to dial in a 5-10min game for when the little kids are playing, but when the adults are playing we would want to up it to 20-30min.
so I plan to put the POT in to allow us to adjust the game time before the A key is pressed to arm the device.

I get why you would want to do that and yes your idea would be much easier to change the time but why not just play the game with the kids and set the timer to like 600 or something then when there done re-upload the code but set the timer to 1800 or something. And if you really need it to be simpler why not instead of having a pot just use 2 buttons that when pressed if the prop is not armed or disarmed they will add or subtract 60 from the timer. though you may want a display screen for that to make knowing how long the timer is.

Yes, thats a much more elegant solution. I can just use a switch and have an "if high" then the game time is 30min and "if low" the game time is 10min. Thanks a lot

My new stepper motor for my printer is due tomorrow so I should be able to post a full make soon as I have the electronics completed.

Thanks for your design, code and help

Bro your welcome and thank you for having an interest and feedback on my work. I hope all goes well with you and your idea. I'm busy this week otherwwise i would offer to help code your idea but since i cant i wish you the best of luck