Mini Bowling Alley ...
 
Notifications
Clear all

Mini Bowling Alley Pin Setter coding project In need of tutoring...

169 Posts
7 Users
4 Likes
40.8 K Views
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  
Posted by: @casey

I notice you have activated the internal pull up resistor and also have one in the circuit?
If you are going to have an external resistor you should use,
pinMode(buttonPin , INPUT);
not
pinMode(buttonPin , INPUT_PULLUP);

Yes good point wanted to remove that actually... I will correct that tonight when I get home!

Posted by: @codecage

I'm still not understanding why the wiring diagram has two 5V lines at the proto board from the UNO.

I am taking the the 5v to the breadboard as to share 5v with the PCA9685, Button, and IR Beam Break.  The PCA9685, while it has to have an external power supply for the servos, it still needs power from the Arduino to run the chip on the PCA9685 board. 


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1037
 

@dundervetter

I see that now, guess my eyes were seeing the crossing of the two red wires below the 5V pin of the UNO as being a physical connections and not just two individual insulated red wires.  I seem to have forgotten that your drawing was actually a physical layout of parts and not a schematic.

Sorry for the extra curve balls I've been throwing you! ? 

SteveG


   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  

@codecage

no, no worries... I know that sometimes that I might not be explaining myself the best, coupled with my newbie brain when it comes to all of this... thank you though for asking and keeping me on point!


   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  

@ZeFerby

I am just thinking and wondering something...

Would it be possible to create another case/state for a complete and total reset of the system?  

I know physically it would take another button, and another button state... 

So I am thinking it would be "one state to rule them all".  Lord of the Rings referance... lol ? 

I have not committed this to code yet... just thinking out loud (third item I guess on wish list)...

 


   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  
Posted by: @casey

You should also be able to remove the servo chatter. I would look for a solution.
https://learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors/if-the-servo-misbehaves

Thank you I am going to look at this now!

I now have capacitors on order... should be here tomorrow... Thank you!  Senior moment... I do remember seeing this mentioned in the Adafruit PDF but the synapses were not firing... so thank you... I am hoping this will help, but again if the noise it there its there... Major accomplishment is that the system it runs!!!!! Thank you everyone!!!!

This post was modified 4 years ago by Dundervetter

   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  

The pin setter is working as planned!  I want to get a video in here sooner but that just didn't work out this morning.  

As stated before kinda curious if I could at a state as an emergency reset to return all of the servos to the rest position if you will.  

I really have learned a lot and will continue to learn!

Thank you @Robo-Pi @casey @codeage @zeferby @pugwash @dronebot-workshop

I hope I can return the favor in some way shape of form to you guys... I already have the next project in mind...

it will be going into this... soon

set sample
This post was modified 4 years ago by Dundervetter

   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 

Eric


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@zeferby

[another approach for that would be to use interrupts, but that's another subject...]

That is exactly how I would approach this. And my guess, a simpler solution, but the delay()s have to go!


   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  

@pugwash @zeferby

Posted by: @pugwash

That is exactly how I would approach this. And my guess, a simpler solution, but the delay()s have to go!

Posted by: @pugwash

[another approach for that would be to use interrupts, but that's another subject...]

I am totally with on the efficiency aspect of removing the delays... sadly in my newbie brain it worked...

How do interrupts work if I may ask and it does take a long time to explain?  Then, with interrupts, would you need to use Hall Effect switches?

I am not saying I going to change everything up at this point... I just want to learn from all of this!


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@dundervetter

How do interrupts work if I may ask and it does take a long time to explain?  Then, with interrupts, would you need to use Hall Effect switches?

I was thinking more in terms of using interrupts with your IR light sensors, and Hall Effect sensors for the pinsetter itself.

Before I explain anything wrongly, the Arduino Reference Language section has all you need to know about setting up interrupts. And NO, it is not complex.

https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 

@dundervetter

As you can see here, interrupts are a hardware-triggered way of interrupting you program flow, to execute a VERY SHORT piece of code before resuming the program flow (usually simply setting one or two global volatile variables, which are read somewhere else in your code); they highly depend on what board you are using, and thus are one of the least portable features between different platforms (Arduino, STM32, ESPxxx, etc).  There are several restrictions on what you can/should do in an ISR = Interrupt Service Routine as explained in the Arduino reference (navigate from the link above to explore).

For a newbie, I would advise you first to master the "pseudo-timer" technique shown above before playing with interrupts.

However, in time you will want to explore them because they give the most timely response to events...and you'll soon want more available interrupt-enabled pins than what your board offers ? 

Eric


   
ReplyQuote
(@zeferby)
Member
Joined: 5 years ago
Posts: 355
 
Posted by: @pugwash

And NO, it is not complex

Lol, you are a quicker typist than me !

Well, interrupts are not complex per se, but I think the associated restrictions are often overlooked, and basic coding techniques should be the first focus when we are not yet with uSecond-magnitude requirements.

Eric


   
ReplyQuote
Dundervetter
(@dundervetter)
Member
Joined: 4 years ago
Posts: 75
Topic starter  

@pugwash @zeferby

Thank you both... more food for thought... 

I am thinking of getting some Hall effect sensors to play with... not for the pinsetter for now


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 

@zeferby

I was thinking about nothing more than setting a boolean value and detaching the interrupt that fired it.

Can't get shorter than that???


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
 
Posted by: @dundervetter

@pugwash @zeferby

Thank you both... more food for thought... 

I am thinking of getting some Hall effect sensors to play with... not for the pinsetter for now

Just bear in mind there are different types of Hall Effect Sensor. Be sure to check out Bill's video before deciding which type you want to use!


   
ReplyQuote
Page 11 / 12