d'apres le lien que vous m'avez envoyer il semble que les cny70 se place sur de l'analogique mais ou exactement je ne sais pas..

de plus j'aimerais savoir comment relier les pattes des cny70 a l'endroit ou elle doivent être souder.
Il y a 6 élément(s) pour Natsu_ (recherche limitée depuis 08-juillet 14)
Posté par
Natsu_
sur 15 février 2012 - 06:08
dans
Aide pour projets scolaire
Posté par
Natsu_
sur 15 février 2012 - 06:04
dans
Archives
Posté par
Natsu_
sur 15 février 2012 - 02:34
dans
Aide pour projets scolaire
main: readadc 0, b0 debug goto main Now take your hand in front of the robot´s head and notice how the variable b0 changes value. You can use the knowledge gained to decide what should happen and when (how close things should get before..) You may notice how things start to go "wrong" if stuff is too close to the "eyes"; The Sharp is made to work with objects 10-80 cm away. Things that are closer than 10 cm (4 inches) appear to be further way, which can be quite a challenge to program. You can get many other distance sensors that do not have this problem. However the Sharp is the cheapest, and easiest to program, so that's why I made such a "bad" choice for you, sorry <img src='http://www.robot-maker.com/forum/public/style_emoticons/<#EMO_DIR#>/wink.gif' class='bbc_emoticon' alt=';)' /> Look around and see what everyone else is using, before you decide on an upgrade. Now I advise you to put your robot up on a matchbox or similar, as the wheels will start turning. Enter this code into your editor, and press F5 while the robot is connected: high 4 low 5 One of the wheels should turn in one direction. Does your wheels turn forward? If so, this is the instruction for that wheel to turn forward. If the wheel is turning backwards, you can try this: low 4 high 5 To turn the other wheel, you need to enter high 6 low 7 (or the other way around for opposite direction.) What happens here is that by using only the options available to the microcontroller; power on or off (High / Low) on the pins, it is commanding the motor controller to set motor A or B in forward or reverse mode. low 4 low 5 low 6 low 7 stops all motors The servo you have already tried. All the way to one side is: servo 0, 75 wait 2 - the other side is: servo 0, 225 wait 2 - and centre: servo 0, 150 wait 2 Here is a small program that will (should, if all is well, and if you inserted the right parameters for high/low to suit your wiring to the motors) make the robot drive around, stop in front of things, look to each side to decide which is the best, turn that way, and drive towards new adventures. In the code I have made so called remarks: explaining you what is going on. You can write such comments or remarks yourself in the code, it is a good idea to keep track. They are written with an apostrophe (or single quote) sign. However, copying this text from here might alter that to something else, and you will have to fix that manually, sorry. Your programming editor has colour codes, that will help showing you what it recognizes as comments and what as code. Symbol dangerlevel = 70 ' how far away should thing be, before we react? symbol turn = 300 ' this sets how much should be turned symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it´s speed) before we measure distance main: ' the main loop readadc 0, b1 ' read how much distance ahead if b1 < dangerlevel then gosub nodanger ' if nothing ahead, drive forward else gosub whichway ' if obstacle ahead then decide which way is better end if goto main ' this ends the loop, the rest are only sub-routines nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors high 5 : high 6 : low 4 : low 7 return whichway: gosub totalhalt ' first stop! 'Look one way: gosub lturn ' look to one side pause servo_turn ' wait for the servo to be finished turning readadc 0, b1 gosub totalhalt 'Look the other way: gosub rturn ' look to another side pause servo_turn ' wait for the servo to be finished turning readadc 0, b2 gosub totalhalt ' Decide which is the better way: if b1<b2 then gosub body_lturn else gosub body_rturn end if return body_lturn: high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way pause turn : gosub totalhalt return body_rturn: high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way pause turn : gosub totalhalt return rturn: servo 0, 100 ' look to one side return lturn: servo 0, 200 ' look to the other side return totalhalt: low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot! Servo 0,150 ' face forward wait 1 ' freeze all for one second return
Posté par
Natsu_
sur 14 février 2012 - 07:52
dans
Archives
Posté par
Natsu_
sur 14 février 2012 - 07:24
dans
Aide pour projets scolaire
Posté par
Natsu_
sur 18 janvier 2012 - 04:29
dans
Aide pour projets scolaire