Aller au contenu


Natsu_

Inscrit(e) (le) 18 janv. 2012
Déconnecté Dernière activité févr. 16 2012 07:26
-----

Messages que j'ai postés

Dans le sujet : Projet de TPE !

15 février 2012 - 06:08

oui je possède 2 réflecteur cny70

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.. :wacko:
de plus j'aimerais savoir comment relier les pattes des cny70 a l'endroit ou elle doivent être souder.

Dans le sujet : robot suiveur de ligne

15 février 2012 - 06:04

merci ;)
(pour le lien on m'as toujours dis de faire profiter les autres :lol: )

quel sera l'intermédiaire entre les 4 pattes de la cny70 à la picaxe ? (autrement dit comment peut on les relier ? :blink: )

et si je résume c'est 2 pattes sur la masse 1 à la sortie et 1 à l'entrée ?

voila :)

Dans le sujet : Projet de TPE !

15 février 2012 - 02:34

merci pour votre aide ! :)
le matériel que je possède est le même que sur le lien que j'ai posté c'est à dire :

- PICAXE-28X1 Starter Pack
Image IPB

- L293D Motor Driver
Image IPB

- PICAXE Servo Upgrade Pack
Image IPB

- Sharp GP2D120 IR Sensor - 30cm / Analogique
Image IPB

2 Gear Motors with wheels (moteurs avec démultiplication et roues)
Image IPB

et enfin les cny70 !

une fois le tout monter le robot ressemble a peu près à ça (sans les réflecteurs optique) :
Image IPB


Pour la programmation voila ce que j'ai suivi :

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/default/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

voila ...
j'ai une autre question.. si les réflecteur optique cny70 se branche sur de l'analogique comment faudra il les souder pour qu'elle soit relier a la picaxe ?

Dans le sujet : Projet de TPE !

14 février 2012 - 07:24

personne ne peux m'aider ?? :/