Le pack
Ouverture d’une batterie de vélo électrique d’une tension de 36V :
- 2×10 éléments de 3.7V – 5000 mAH
Le BMS : battery management system
- Mosfet : STP75NF75
- S-8204B : battery protection
Kit robotique disponible en boutique : https://shop.macerobotics.com/produit/kit-chassis-mr-rescue/
Un tutoriel pour gérer le buzzer et le led RGB du robot mobile MRPiZ (version 0.8) en langage C.
Un exemple pour utiliser le buzzer :
[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0A%0A%20%20init()%3B%0A%0A%20%20buzzer(100)%3B%20%2F%2F%20fr%C3%A9quence%20de%20100%20Hz%0A%0A%20%20sleep(3)%3B%0A%0A%20%20buzzer(200)%3B%20%2F%2F%20fr%C3%A9quence%20de%20200%20Hz%0A%0A%20%20sleep(3)%3B%0A%0A%20%20buzzer(0)%3B%0A%7D” message=”” highlight=”” provider=”manual”/]
buzzer(frequency)
Un exemple pour utiliser la led RGB :
[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0A%0A%20%20init()%3B%0A%0A%20%20while(1)%0A%20%20%7B%0A%0A%20%20%20%20ledRGB(1%2C0%2C0)%3B%0A%0A%20%20%20%20sleep(3)%3B%0A%0A%20%20%20%20ledRGB(0%2C1%2C0)%3B%0A%0A%20%20%20%20sleep(3)%3B%0A%0A%20%20%20%20ledRGB(0%2C0%2C1)%3B%0A%0A%20%20%20%20sleep(3)%3B%0A%20%20%7D%0A%7D” message=”” highlight=”” provider=”manual”/]
ledRGB(red, green, blue)
Un tutoriel pour programmer le robot mobile MRPiZ en langage C.
Lien pour l’API C : https://github.com/macerobotics/MRPiZ/tree/master/Software/C
Les fichiers doivent être placer dans des répertoires:
Un exemple pour déplacer le robot MRPiZ:
[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0A%0A%20%20init()%3B%0A%0A%20%20forward(25)%3B%0A%0A%20%20sleep(3)%3B%0A%0A%20%20back(25)%3B%0A%0A%20%20sleep(3)%3B%0A%0A%20%20stop()%3B%0A%7D” message=”” highlight=”” provider=”manual”/]
Compilation du fichier :
[pastacode lang=”c” manual=”gcc%20sources%2F*.c%20-I%20header%20-o%20Exemple1″ message=”” highlight=”” provider=”manual”/]
Exécution du programme :
[pastacode lang=”c” manual=”.%2FExemple1″ message=”” highlight=”” provider=”manual”/]
Un exemple pour la lecture des 3 capteurs ToF du robot :
[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0Aint%20p2%2C%20p3%2C%20p4%3B%0Aint%20c%3D0%3B%0A%0A%20%20init()%3B%0A%0A%20%20for(c%3D0%3B%20c%20%3C%2010%3B%20c%2B%2B)%0A%20%20%7B%0A%20%20%20%20p2%20%3D%20proxSensor(2)%3B%0A%20%20%20%20p3%20%3D%20proxSensor(3)%3B%0A%20%20%20%20p4%20%3D%20proxSensor(4)%3B%0A%0A%20%20%20%20printf(%22Capteur%20p1%3D%25d%5Cn%22%2C%20p2)%3B%0A%20%20%20%20printf(%22Capteur%20p2%3D%25d%5Cn%22%2C%20p3)%3B%0A%20%20%20%20printf(%22Capteur%20p3%3D%25d%5Cn%22%2C%20p4)%3B%0A%20%20%0A%20%20%20%20sleep(1)%3B%0A%20%20%7D%0A%20%20%0A%7D” message=”” highlight=”” provider=”manual”/]
Un exemple pour la lecture des 2 encodeurs du robot.
[pastacode lang=”c” manual=”%23include%20%22MRPiZ.h%22%0A%0A%0Aint%20main(int%20argc%2C%20char*%20argv%5B%5D)%0A%7B%0Aint%20eL%2C%20eR%3B%0Aint%20c%3B%0A%0A%20%20init()%3B%0A%0A%20%20for(c%3D0%3B%20c%20%3C%2010%3B%20c%2B%2B)%0A%20%20%7B%0A%09%20%20%0A%09forward(30)%3B%0A%09%0A%20%20%20%20eL%20%3D%20encoderLeft()%3B%0A%20%20%20%20eR%20%3D%20encoderRight()%3B%0A%0A%20%20%20%20printf(%22encoder%20left%3D%25d%5Cn%22%2C%20eL)%3B%0A%20%20%20%20printf(%22encoder%20right%3D%25d%5Cn%22%2C%20eR)%3B%0A%0A%20%20%20%20sleep(1)%3B%0A%20%20%7D%0A%20%20%0A%20%20stop()%3B%0A%0A%7D” message=”” highlight=”” provider=”manual”/]
Fin du tuto !
Générer un signal carré avec le logiciel LTspice :
1-> Choisir la fonction PULSE dans le composant voltage:
2 -> Exemple avec un signal carré de 0-5V de 10 hz :
Fin.
An example python program for control a mobile robot with keyboard:
[pastacode lang=”python” manual=”%0A%23!%2Fusr%2Fbin%2Fpython%0A%23%20-*-%20coding%3A%20iso-8859-15%20-*-%0A%23%20Author%20%3A%20Mace%20Robotics%20(www.macerobotics.com)%0A%23%20Date%20%3A%2005%2F04%2F2020%0A%23%20Version%20%3A%200.1%0A%23%0Aimport%20serial%0Aimport%20keyboard%0Aimport%20time%0A%0Aprint(%22Control%20borvo%20with%20keyboard%22)%0A%0Aport%20%3D%20serial.Serial(‘COM6’)%0Aprint(port.name)%0A%0Aprint(%22wait..%22)%0Atry%3A%0A%20%20%23%20read%20keyboard%0A%20%20while%201%3A%0A%20%20%20%20if%20keyboard.is_pressed(‘8’)%3A%20%20%23%20if%20key%20’8’%20is%20pressed%20%0A%20%20%20%20%20%20print(‘forward’)%0A%20%20%20%20%20%20port.write(b’FOR!’)%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘2’)%3A%20%20%23%20if%20key%20’2’%20is%20pressed%20%0A%20%20%20%20%20%20print(‘move%20back’)%0A%20%20%20%20%20%20port.write(b’BAC!’)%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘4’)%3A%20%0A%20%20%20%20%20%20print(‘turn%20left’)%0A%20%20%20%20%20%20port.write(b’TUL!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘6’)%3A%20%20%0A%20%20%20%20%20%20print(‘turn%20right’)%0A%20%20%20%20%20%20port.write(b’TUR!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%20%20%20%20if%20keyboard.is_pressed(‘5’)%3A%20%20%0A%20%20%20%20%20%20print(‘stop’)%0A%20%20%20%20%20%20port.write(b’STP!’)%09%20%0A%20%20%20%20%20%20time.sleep(0.5)%0A%0Aexcept%20KeyboardInterrupt%20as%20exception%3A%0A%20%20print(%22%5CnEnd%5Cn%22)%0A” message=”” highlight=”” provider=”manual”/]