|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: swerve drive with arduino mega 2560
Becky,
Assuming you still have the speed controllers wired up the same way you had in your picture earlier, I think Scott is on the right track. It looks like you have your speed controllers wired near the pin 0 / pin 14 area. (I would move the wires if you use pin 0 or pin 1 as those are also used for the USB connection.) In order for the speed controllers to work, they each need two wires; a signal wire (which I think is your white wire) and ground wire (the black wire). You can use most any pin for the signal - you just need to change the sketch to attach to the one you use, but you also need a the ground. A ground connection can be found next to pin 13 as well as on the opposite side of the mega in the "power" section. You may already have the ground running from across the board, but it is hard to see in the picture. If you actually have the ground connected, then just change the "9" in the myservo.attach(9) statement in the Sweep example to the pin number you are actually using (not 0 or 1). If you do not the ground connected, and you have a standard 3 pin connector on the end of your PWM cable, then it would be easier to plug one cable direcly to pins 12 (white), 13 (red) & gnd (black). Then change the "9" in the myservo.attach(9) to "12". (just verify that the black wire does indeed go to the ground connection on the Talon). Mike |
|
#2
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
FYI, not all Arudino Outputs are PWM compatible.
Code:
PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with the analogWrite() function ![]() |
|
#3
|
|||
|
|||
|
Re: swerve drive with arduino mega 2560
Scott - I believe the Servo library uses a timer and software to generate the PWM signal, so it is independent of the hardware generated PWM pins.
Becky – Getting back to one of your older questions. You don’t have to have a steering sensor if you are only going to run it in a “tele-operated” like mode if you want to keep things simple, although it will still be useful if you want it to drive in some modes. However, if you want to do autonomous driving, then you will definitely need a sensor to know the actual wheel position. I’ve had good luck with these. Specifically the 6127V1A360L.5FS. For mounting you really need these to be 1:1 with your wheel modules so the analog value will directly relate to a direction on the wheels. Since your steering motor uses a smaller sprocket than the swerve module, I’d install another shaft with the same size sprocket on one of the other wheels and attach the position sensor to that. This should be fairly easy since you have the double sprockets at each wheel. One thing to remember is that these sensors generally do not like high side loads, so I wouldn't recommend putting the sprocket directly on the sensor shaft. Mike |
|
#4
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
If you are having trouble you can use the library I wrote to control FRC motor controllers. check the link below, and consult the wiki for help.
|
|
#5
|
|||||
|
|||||
|
Re: swerve drive with arduino mega 2560
Quote:
![]() |
|
#6
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
![]() |
|
#7
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
|
|
#8
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
i went to the link but it ended up just confusing me
|
|
#9
|
||||
|
||||
|
Re: swerve drive with arduino mega 2560
Go to the Files tab and download the files, and then when you have it downloaded go to the Wiki tab to learn how to use it. I'm willing to walk you through it.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|