Jump to content

Recommended Posts

Posted

My bad about the PWM. I mixed that up, sorry. <br>

I need to read the code once more, it' s been a while. ;-)<br>

But I know that the main LED is always on, by default.<br>

Also try to change to a other LED typ for better pulsing.

Posted (edited)

Just reading the specs on my particular drivers and it says "high level = off" so I'm imagining the reason mine are on from startup is because I need to reverse the setting I quoted in my previous post.<br><br>

I will try swapping the digitalwrite high to low and vice versa throughout the sketch when I get home tonight and post an update.

Edited by Balders
Posted

The RGB will come on and stay on at bootup for about 3 seconds then go off, you must have something wrong with the wiring Steve. there are some drivers out their that have the same part numbers but are the opposite side for the wiring, that I had to find out. 

Posted

I'm going to try a very simple sketch on a spare arduino and led/driver when I get home to prove a theory. Having read through skyone's programming, I'm pretty convinced I simply need to switch the high and low values on the digitalwrites and then sort out where there is an analogwrite value, due to my led drivers using HIGH as off.<br><br>

Thanks very much for the suggestions so far. Really enjoying this project and learning about arduino. Had no experience of it or programming in general before I discovered this thread.

Posted (edited)

OK, tonights update. I've made significant progress. I've swapped HIGH for LOW where I could find a reference such as: <br>

digitalWrite(ledPin, LOW); //red<br>

digitalWrite(ledPin10, LOW); <br>

digitalWrite(ledPin9, LOW); <br><br>

Now my LED is diminished most of the time with one colour flashing which I've found is based on one of the delay times (think it was set to 250 default). I found by changing the value of this, the blinking rate of the main led changed, but why it blinks in the first place is still a mystery. If I hold the "fire" button the led goes off altogether (ie stops flashing) likewise it doesnt flash during the reload cycle.<br><br>

However I'm still not able to "fire" the led when pressing the fire button, so there may still be something I've not changed or done correctly. I am particularly unsure of where there is a "fade" control in the code, but I feel like I've made a little progress. At least I seem to have proven the HIGH = Off PWM setting on my particular drivers :)

Edited by Balders
Posted

OK, tonights update. I've made significant progress. I've swapped HIGH for LOW where I could find a reference such as: <br>

digitalWrite(ledPin, LOW); //red<br>

digitalWrite(ledPin10, LOW); <br>

digitalWrite(ledPin9, LOW); <br><br>

Now my LED is diminished most of the time with one colour flashing which I've found is based on one of the delay times (think it was set to 250 default). I found by changing the value of this, the blinking rate of the main led changed, but why it blinks in the first place is still a mystery. If I hold the "fire" button the led goes off altogether (ie stops flashing) likewise it doesnt flash during the reload cycle.<br><br>

However I'm still not able to "fire" the led when pressing the fire button, so there may still be something I've not changed or done correctly. I am particularly unsure of where there is a "fade" control in the code, but I feel like I've made a little progress. At least I seem to have proven the HIGH = Off PWM setting on my particular drivers :)

 

 

What type of drivers are you using, do you have a picture of them, there is nothing wrong in the code as I have made 7 of these so far.

Posted

Yup, have a look at post #236 in this thread. Page 12 on my screen. Thanks for looking. I'm sure the code is just fine, and it's something to do with my pwm drivers needing high for off instead of low.

Posted (edited)

Inspired by Manuel I've decided to give it a go myself and put this project together. It seems however, I've hit a little roadblock. I tried not to get everything running at once but follow a step-by-step approach. The first step was just to get the sounds (actually one firing sound) running using Manuels Code here >>> http://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/?p=295206

 

This worked just as it should (I only rearranged the start up sound and the weapon):

 

https://youtu.be/oh54s2ZJu3I

 

However, when I installed the three buttons/selectors and uploaded the full code the system went a little bonkers and repeated one firing sound all the time and only reacted to the reload switch:

 

https://youtu.be/SHAxRLgEGJM

 

Any ideas about what might be the problem would be highly appreciated :)

 

 

 

Edit: Known deviations from the original layout: 5V powered, Resistors for weapon select and weapon reload are 20 kOhm (I ran out of 10k resistors)).

 

Edit Update 2: I've changed the resistors to the 10k ones. Also I've noticed, when I hold the fire button pressed the firing stops and only resumes when I let it go again.

Edited by StriderX
Posted

Inspired by Manuel I've decided to give it a go myself and put this project together. It seems however, I've hit a little roadblock. I tried not to get everything running at once but follow a step-by-step approach. The first step was just to get the sounds (actually one firing sound) running using Manuels Code here >>> http://www.whitearmor.net/forum/topic/19322-arduino-a-cheap-board-for-e11-blaster-effects/?p=295206

 

This worked just as it should (I only rearranged the start up sound and the weapon):

 

https://youtu.be/oh54s2ZJu3I

 

However, when I installed the three buttons/selectors and uploaded the full code the system went a little bonkers and repeated one firing sound all the time and only reacted to the reload switch:

 

https://youtu.be/SHAxRLgEGJM

 

Any ideas about what might be the problem would be highly appreciated :)

 

 

 

Edit: Known deviations from the original layout: 5V powered, Resistors for weapon select and weapon reload are 20 kOhm (I ran out of 10k resistors)).

 

Edit Update 2: I've changed the resistors to the 10k ones. Also I've noticed, when I hold the fire button pressed the firing stops and only resumes when I let it go again.

 

 

What happens if you pull the wire of the breadboard from the switch, does the firing stop.

Make sure your switch is normally open contacts.

Posted

OK, tonights update. Ie significant progress. I've swapped HIGH for LOW where I could find a reference such as: <br>

digitalWrite(ledPin, LOW); //red<br>

digitalWrite(ledPin10, LOW); <br>

digitalWrite(ledPin9, LOW); <br><br>

Now my LED is diminished most of the time with one colour flashing which I've found is based on one of the delay times (think it was set to 250 default). I found by changing the value of this, the blinking rate of the main led changed, but why it blinks in the first place is still a mystery. If I hold the "fire" button the led goes off altogether (ie stops flashing) likewise it doesnt flash during the reload cycle.<br><br>

However I'm still not able to "fire" the led when pressing the fire button, so there may still be something I've not changed or done correctly. I am particularly unsure of where there is a "fade" control in the code, but I feel like I've made a little progress. At least I seem to have proven the HIGH = Off PWM setting on my particular drivers :)

It might be not enoght ampere / volts for your driver, try ysing other external power supply 8v / 12v 1 ampere to your drivers

Posted

 

 

 

 

What happens if you pull the wire of the breadboard from the switch, does the firing stop.

Make sure your switch is normally open contacts.

 

Thanks, Michael. Yes, those were the first things I've tested. Even if the firepin is unswitched it automatically goes into auto-shoot when I start up. It only stops when the pin is installed and pressed (it's wired C / NO). Then everything is functioning normally (the other 2 pins as well) with the exception that the function of the firepin is reverse.

 

Can anyone confirm that the code is correct in this regard? I'm not sure with all the different IF commands :)

  • Like 1
Posted (edited)

Today I've soldered the ammo counter but it's not working. Did I make any mistakes with the soldering (the resistors are all connected to each other and GND on the other side)?

 

20150918_202819_zps0j9xmrbf.jpg

Would it be possible that it doesn't work with the 5V Akku I'm using?

Edited by StriderX
Posted (edited)

Thanks, Michael. Yes, those were the first things I've tested. Even if the firepin is unswitched it automatically goes into auto-shoot when I start up. It only stops when the pin is installed and pressed (it's wired C / NO). Then everything is functioning normally (the other 2 pins as well) with the exception that the function of the firepin is reverse.

 

Can anyone confirm that the code is correct in this regard? I'm not sure with all the different IF commands :)

did you try to invert HIGH/LOW in the code of your trigger switch?

Edited by skyone
Posted

Today I've soldered the ammo counter but it's not working. Did I make any mistakes with the soldering (the resistors are all connected to each other and GND on the other side)?

 

20150918_202819_zps0j9xmrbf.jpg

Would it be possible that it doesn't work with the 5V Akku I'm using?

did u find the right positive and negative side on the led bar?

Posted

did you try to invert HIGH/LOW in the code of your trigger switch?

 Ha, cool workaround! Thx Manuel! I've changed from C/NO to C/NC and now it works as it should :)

 

Now only need the ammo counter to run :)

Posted

YES!  Got mine working with the same fix as above, had to swap this value:

 

 if (buttonState2 == LOW)

 

to:

 

 if (buttonState2 == HIGH) 

 

and now it works

Posted (edited)

Haha, you won't believe this...just about got things working for the first time, then managed to short a ground and one of the led drivers (I think, and now my nano won't power on from the Vin .  Weirdly it's ok if I power from USB and I've checked voltage is getting to the pins etc.  At least I have a spare arduino.  Off to warm the soldering iron up!

 

EDIT:

 

OK, new arduino in place, nearly got it working as plan, just an issue with the LED staying on after change of weapon, but hopefully I will get that sorted.  Once it's all working for me, shall I post my "upside down" code for anyone else who buys the same led drivers as I did?

 

https://youtu.be/IV0d6BvbumI

 

EDIT2:

 

OK, also figured out that one (sort of). It was trying to do the fade loop inverse of my silly PWM drivers, so for now, I've simply added a number of decreasing values with a short delay to give the same appearance.  I did manage to get the mathematical fade working, but it looped and I couldn't stop it.

Edited by Balders
Posted (edited)

did u find the right positive and negative side on the led bar?

 

Right on the money, as always bro ;-) Yes, I switched the positive and negative side. I still don't see any clear markings to distinguish them on the bar counter but I just used the other pole ;-)

 

So, finally it's working - Manuel, I hats off to you, you've been a tremendous help!!

 

I haven't installed the LEDs yet for 2 reasons. First, I'm still waiting for the current regulators and secondly - as I'm aiming to put this into an MG15/RT97 - I'm still thinking of using a different setup where you have the lights going up the barrel. I'll definitively put up a vid of y final setup once it's finished.

 

https://youtu.be/9QhspS8bBMQ

 

P.S.: My little kids found the Jawa noises hillarious :)

Edited by StriderX
Posted

The bar counter is kind of marked but it's very subtle...one of the corners is ever so slightly rounded off.  You'll notice 3 have a sharp edge and the 4th is slightly bevelled.

Posted (edited)

 

Right on the money, as always bro ;-) Yes, I switched the positive and negative side. I still don't see any clear markings to distinguish them on the bar counter but I just used the other pole ;-)

 

So, finally it's working - Manuel, I hats off to you, you've been a tremendous help!!

 

I haven't installed the LEDs yet for 2 reasons. First, I'm still waiting for the current regulators and secondly - as I'm aiming to put this into an MG15/RT97 - I'm still thinking of using a different setup where you have the lights going up the barrel. I'll definitively put up a vid of y final setup once it's finished.

 

 

P.S.: My little kids found the Jawa noises hillarious :)

good work!

Edited by skyone
Posted

The bar counter is kind of marked but it's very subtle...one of the corners is ever so slightly rounded off.  You'll notice 3 have a sharp edge and the 4th is slightly bevelled.

 

Yeah, I saw something like this in the manual but it must be too subtle for my eyes to detect ;-)

 

Adam's approach sounds like the way to go for me in future projects :duim:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...