Réparation d’une carte électronique d’un poste à souder Transpocket 1500 de la marque Fronius :
Exemple de contrôle d’une led sur le port PE8 avec un microcontrôleur STM32F407 :
[pastacode lang=”c” manual=”void%20led_init(void)%0A%7B%0AGPIO_InitTypeDef%20GPIO_InitStruct%3B%0A%0A%09%20%20%2F%2F%20configuration%20en%20sortie%0A%09%20%20GPIO_InitStruct.Pin%20%3D%20GPIO_PIN_8%3B%0A%09%20%20GPIO_InitStruct.Mode%20%3D%20GPIO_MODE_OUTPUT_PP%3B%0A%09%20%20GPIO_InitStruct.Pull%20%3D%20GPIO_NOPULL%3B%0A%09%20%20GPIO_InitStruct.Speed%20%3D%20GPIO_SPEED_FREQ_LOW%3B%0A%09%20%20HAL_GPIO_Init(GPIOE%2C%20%26GPIO_InitStruct)%3B%0A%0A%7D%0A%0Avoid%20led_control(GPIO_PinState%20state_led)%0A%7B%0A%09HAL_GPIO_WritePin(GPIOE%2C%20GPIO_PIN_8%2C%20state_led)%3B%0A%7D%0A%0Avoid%20led_toggle(void)%0A%7B%0A%20%20HAL_GPIO_TogglePin(GPIOE%2C%20GPIO_PIN_8)%3B%0A%7D” message=”” highlight=”” provider=”manual”/]
Une vidéo de présentation du robot MRPiZ :
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 !