Coin Pusher Help - Servo+button+led+matrix+sound

Hello everyone,

Sorry for my english...

It'sb been a while i'm hoping for a solution...
So here's the thing : to complete my project, i will pay you. Paypal,etc....
I just need the code.
Maybe if i have it i can read it and try to understand a pattern.
I'm just a carpenter trying to do something out of his league. So i need help...

So here is my initial message :

I'm new at Arduino and after few weeks of work, i fell like i need help for my project. Insomnia are not always good ! :slightly_smiling_face:

I did build a cool Coin Pusher machine like the ones at fair. I'll send a pic. All the mechanic parts are ok but i'm struggling with Arduino part.

The idea is to pit lights, sounds, motor,etc in the machine so it will look better.

What i'm trying to do :slightly_smiling_face:

During the play : ---- an matrix 7219 will play different texts and funny logos.
----- a ledring (neopixel 24) will play cool lights (mainly orange and red types).

WHEN Bonus is activate via a button :
----- Matrix 7219 will write a text (for example "Winner").
------ Ledring will make a cool rainbow template (or anything coolest).
------ A sound will be play via an ISD1820 (or even better, 2 or 3 random sounds).
------- The servo motor will sweep from "x" degrees slowy and then will come back
in initial position.

I know it's a lot to ask...

I began to create this via Wokwi but i do have some issues with the code (electronic connections = i can manage more or less).

If by chance they're anyone here who can help me figure it out...
Or better : have cool ideas to enhace this machine.

Thanks You SO MUCH.

Here is the link to the Wokwi test (i'm still working on it).

Thanks !!!

My code needs a lot of work but i'm still on it !!


#include <Servo.h>

Servo myservo; 

int pos = 0;    // variable to store the servo position
int button = 3;
int etatbutton = 0;
int led = 2;



#include <Adafruit_NeoPixel.h>

#define PIN        2 
#define NUMPIXELS 24

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 25 // Time (in milliseconds) to pause between pixels

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>


#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10




void setup() {
   pinMode (button, INPUT) ;

  myservo.attach(9); 
}




void loop() {
  
  
  etatbutton = digitalRead (button); 

  if (etatbutton==LOW) {        

  
   // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  for(int i=0; i<NUMPIXELS; i++) { // For each pixel...

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(150, 150, 0));

    pixels.show();   // Send the updated pixel colors to the hardware.

    delay(DELAYVAL); // Pause before next pass through loop
  }  
    { 
    
    delay(500);


  for (pos = 90; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 90; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
 
 
}          
    
  
  }}


1 Like

no double posting please. I've closed the post in French so that the discussion can happen here.

if you prefer to have the discussion in French, then let us know here and we will close this one and re-open the French version.

--

In the mean time please read How to get the best out of this forum and post accordingly

Ok, didn't know. Perfect in english. Thanks !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.