Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!




Trigger arduino by ...
 
Share:
Notifications
Clear all

[Solved] Trigger arduino by a pulse?

5 Posts
2 Users
0 Likes
2,463 Views
(@jlpicard)
Active Member
Joined: 5 years ago
Posts: 6
Topic starter  

I am a great fan of your sketches here hans and have done the all effects in one sketch with a lot of fun and I am ready to get going with a practical application.  I build virtual pinball cabinets as a hobby and would like to incorporate the marquee effect, one on right side of playing field and second on the left.  I need them to initiate when certain events trigger in a game which the installed microcontroller would then generate a pulse (negative or positive can be set).  Can you tell me if I can trigger an arduino with a pulse like I describe?


   
ReplyQuote
(@jlpicard)
Active Member
Joined: 5 years ago
Posts: 6
Topic starter  

Pin 2 with gnd pulse?


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
 

Hi jlpicard!

Thanks for the compliments and great to hear you've had a lot of fun with the code. 

For your purpose you could work indeed with an Arduino.
I assume that you want to tap the signal of a solenoid? In that case (since I don't know the voltage of the solenoid), you could try placing a relay (same voltage as solenoid) in parallel with the solenoid. When the solenoid fires, the relay would trigger as well - the switch part of the relay then can be used as a "switch" for the Arduino.

To apply the Marquee effect, you could use the All-in-one sketch and slightly butcher it, so it restarts and runs the marquee effect only once. Something like this;

...
void setup()
{
  FastLED.addLeds<WS2811, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  digitalWrite (BUTTON, HIGH); // internal pull-up resistor
  attachInterrupt (digitalPinToInterrupt (BUTTON), buttonTriggered, CHANGE); // pressed
  theaterChase(0xff,0,0,50); // or whichever effect you have in mind to run only once
}
void loop() { 
  // do nothing
}
void buttonTriggered() {
  if (digitalRead (BUTTON) == HIGH) {
    asm volatile (" jmp 0");
  }
}
...

Here we call one of the effects in setup() instead of in loop() - this way it doesn't keep repeating itself.
The function "buttonTriggered" will reset the Arduino, which then will run setup() again and show the effect.
Once setup() is completed, it will go to loop() and do nothing ... until you reset again (with the switch/relay).

Hope this gets you started - curious about your project! 


   
ReplyQuote
(@jlpicard)
Active Member
Joined: 5 years ago
Posts: 6
Topic starter  

No i am going to use one of the events in your all in one and tie it to probably the flippers in the pinball game.  Hit a flipper and my microcontroller sends a grounding pulse to pin2 on arduino triggering the addressable leds.  This is virtual pinball all run by a gaming pc in my cabinet.  I can send a link to a youtube video if its permitted.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2660
 

Of course you can post a link here to YouTube (or email me). 


   
ReplyQuote


Like what you see and you'd like to help out? 

The best way to help is of course by assisting others with their questions here in the forum, but you can also help us out in other ways:

- Do your shopping at Amazon, it will not cost you anything extra but may generate a small commission for us,
- send a cup of coffee through PayPal ($5, $10, $20, or custom amount),
- become a Patreon,
- donate BitCoin (BTC), or BitCoinCash (BCH).

Share: