Run 8 v2 horn packs
![run 8 v2 horn packs run 8 v2 horn packs](http://mobileimages.lowes.com/productimages/05e2b57e-2cad-4a20-8d8f-f2cba2e14869/00520697.jpg)
getMotor ( 4 ) // create PS2 Controller Class PS2X ps2x //variables used by ps2 controller int error = 0 byte type = 0 byte vibrate = 0 // variables to hold the Motor Commands int motorSpeed = 50 //Speed command is stored here //Variables used from blinking LED int ledState = LOW unsigned long previousMillis = 0 const long interval = 500 //ultrasonic sensor variables const int trigPinFr = 3 //Trigger Pin for the front HC-SR04 const int echoPinFr = 2 //Echo Pin for the front HC-SR04 const int trigPinBk = 9 //Trigger Pin for the back HC-SR04 const int echoPinBk = 4 //Echo Pin for the back HC-SR04 float durationFr, distanceFr float durationBk, distanceBk bool objectDetecFr = false //When object avoidance is on, this variable will be true if the front HC-SR04 detects an object within 15cm bool objectDetecBk = false //When object avoidance is on, this variable will be true if the back HC-SR04 detects an object within 15cm bool objectAvoidOn = false bool vibrateMotors = false //When true the large motor in the ps2 controller will vibrate at "vibrateSpeed" byte vibrateSpeed = 0 void setup () else if (( ps2x. getMotor ( 3 ) Adafruit_DCMotor * FrontLeftMotor = AFMS.
![run 8 v2 horn packs run 8 v2 horn packs](https://sc01.alicdn.com/kf/HTB1ce_KKpXXXXXTXpXXq6xXFXXXg/High-quality-8-OHM-150W-horn-compression.jpg)
getMotor ( 2 ) Adafruit_DCMotor * FrontRightMotor = AFMS. getMotor ( 1 ) Adafruit_DCMotor * BackRightMotor = AFMS. #include #include #include //library by Bill Porter, // Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS = Adafruit_MotorShield () // Creat motor objects Adafruit_DCMotor * BackLeftMotor = AFMS.
Run 8 v2 horn packs serial#
If you do need to use the serial library consider getting rid of this LED.
![run 8 v2 horn packs run 8 v2 horn packs](https://mods.club/uploads/mods/91037-ets2-air-horns-mod-pack-for-ets2-v3-0.jpg)
Because pin 1 and 0 are used for serial communication you can't use the serial library. *note: I wouldn't normally use pin 1 but I was out of pins.
Run 8 v2 horn packs code#
HC-SR04: (I'm showing you the pins the code uses, but can be attached to any digital pins) Would recommend tested each motor separately and swapping the wired if it is running in the wrong direction. lots of great information.Īlso with most DC motors, it's hard to tell the direction that you are wiring them. I would recommend checking out adafruits write-up on the motor shield before started. Motor Shield terminals M1 thru M4: positive and negative terminal. Below is a breakdown of where everything is wired to on the Arduino and motor shield. I have attached the wiring schematic for the whole car but it is quite busy. There are many ways you could arrange all of these items on the car, probably many better ways than I did it, but it worked for me. Conveniently the EMONZY chassis plates come with screw holes that match the HC-SR04 mounting brackets. The HC-SR04 modules were attached to the front and back of the car using the mounting hardware that came with them. I also attached the two breadboards to the top plate. The Arduino Uno (along with the two shields) was this attached to the top plate using M2.5 standoffs. The PS2 breakout board was then mounted to the underside of the top plate. I also tapped down the on/off switch next to it. It's important to make sure this doesn't move around too much when the car is moving. I started by taping down the battery pack to the middle plate. Two 400 point breadboards for LEDs and piezo.6 X AA battery pack with barrel jack connector.Lynxmotion PS2 receiver breakout board.This made room for the battery pack and the PS2 controller reciever. I mounted the top plate using M3 standoffs. This is optional but the extra space was appreciated. I also included an additional chassis plate purchased from pololu robotics ( ) to house the Arduino and breadboards. Just remember that the wheels need to go on a certain way, two of the wheels are for the right side and two for the left. If you are using the chassis kit it is fairly easy to assemble by following the directions. It doesn't matter which lead goes where, just make sure the leads are long enough for your use case. I would first recommend soldering the motor leads on if your motor does not come with them. I bought a chassis plate for the top of the car from.
![run 8 v2 horn packs run 8 v2 horn packs](https://i.ytimg.com/vi/Emg762JKy3k/maxresdefault.jpg)
The chassis plates may be a little harder to come by. Just make sure the wheels will work with the motors that you purchase. However it would be fairly easy to gather up the parts yourself, Adafruit sells very similar motors and gearboxes.