Book for Arduino

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
msilhunter1
 
Posts: 5
Joined: Sat Feb 17, 2018 8:00 am

Book for Arduino

Post by msilhunter1 »

I have the Arduino Mega Board. I am looking for a book that go every in depth such as multiple servo's with different timing and with IR's and distance sensors. Anyone have a good suggestion. Thanks Craig

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Book for Arduino

Post by adafruit_support_bill »

For controlling multiple servos with different timing, see this guide:
https://learn.adafruit.com/multi-taskin ... 1/overview
https://learn.adafruit.com/multi-taskin ... 2/overview

This is one of the more advanced Arduino books, with more detail on working with sensors than most of the into books:
https://www.adafruit.com/product/1457

Also see:
https://books.google.com/books/about/Ge ... &q&f=false
https://books.google.com/books/about/Ma ... e=kp_cover

User avatar
msilhunter1
 
Posts: 5
Joined: Sat Feb 17, 2018 8:00 am

Re: Book for Arduino

Post by msilhunter1 »

Which one will show how to program them with loops inside of loops

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Book for Arduino

Post by adafruit_support_bill »

What is it you are trying to make them do?

User avatar
msilhunter1
 
Posts: 5
Joined: Sat Feb 17, 2018 8:00 am

Re: Book for Arduino

Post by msilhunter1 »

A rotary coal dumper for a model trains. I'll try to put in steps. Green leds are ON. the train approaches the green turn to yellow LEDs . As the train enters the rotary coal dumper the Leds turns to red. A IR's will set the car in place for the rotary dumper. An outside servo will hold the car and then the red leds start flashing, the inside servos pulls the bracket down to hold the car pauses for 2 seconds then the rotary dumper will rotate clockwise to a point pause 2 seconds then return to the original point, the inside servo will release the car, the leds stop flashing but stays on, the outside servos will release the car, then the train will move up and IR,s will set the next car in position. I will use photocell to change the leds and the IR's to set the car in place. This is one of three project that i have going right now. Thanks Craig

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Book for Arduino

Post by adafruit_support_bill »

For tasks like that, I generally prefer to use a timer-based state machine approach as described in the first two parts of the series:
https://learn.adafruit.com/multi-taskin ... 1/overview
https://learn.adafruit.com/multi-taskin ... 2/overview
It is possible to code it linearly as well, but it will be a little tricky to keep the flashing going at a regular rate while performing all the other functions.

The basic idea is to break the coal-dumper process down into a set of 'states' (e.g. idle, train present, car positioned, car grabbed, car dumped, etc.)
Then define what events will cause it to progress from one state to another (e.g. track occupied, car detected, time elapsed etc.)

The light can be a little state machine of its own. It has states: SteadyGreen, SteadyYellow, SteadyRed, FlashingRedOn, FlashingRedOff. It can monitor the millis() timer to control the flash rate. The other states will be controlled by the coal-dumper state machine.

User avatar
msilhunter1
 
Posts: 5
Joined: Sat Feb 17, 2018 8:00 am

Re: Book for Arduino

Post by msilhunter1 »

Can you use photocells and IR's in this program and which book would help me achieve this. I have two more programs that are similar with this one.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Book for Arduino

Post by adafruit_support_bill »

State machines can work with any kind of sensor. The books posted above will help you with the wiring and connections to the sensors.

User avatar
msilhunter1
 
Posts: 5
Joined: Sat Feb 17, 2018 8:00 am

Re: Book for Arduino

Post by msilhunter1 »

I can wire it up but the program gives me trouble. I need a book on programming. I didn't know which book to buy that will cover these type of designs that I am doing and book by Jeremy Blum will help me with this.

User avatar
adafruit_support_bill
 
Posts: 88087
Joined: Sat Feb 07, 2009 10:11 am

Re: Book for Arduino

Post by adafruit_support_bill »


Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”