Une nouvelle version de la librairie Arduino est disponible sur Github :
https://github.com/macerobotics/EsusBoard/tree/master/Software/Arduino
Une nouvelle version de la librairie Arduino est disponible sur Github :
https://github.com/macerobotics/EsusBoard/tree/master/Software/Arduino
Un petit tutoriel pour étaler les empreintes lors de la toute première phase du routage d’un circuit imprimé.
Voilà, fin du tuto.
Dans ce tutorial vous allez apprendre à utiliser les 3 capteurs de sols du robot MRduino afin de faire du suivi de ligne.
Le robot MRduino est équipé de 3 capteurs de sols, ils sont situés à l’avant.
La fonction pour lire le capteur de sol n°1 du robot :
value = groundSensor(1)
Exemple de programme pour lire les 3 capteurs :
#include <mrduino.h> void setup() { Serial.begin(115200); } void loop() { int capteur1, capteur2, capteur3; capteur1 = groundSensor(1); capteur2 = groundSensor(2); capteur3 = groundSensor(3); Serial.println(capteur1); Serial.println(capteur2); Serial.println(capteur3); delay(1000); }
Un tutoriel pour contrôler le robot MRduino Wireless par UDP avec un programme python.
UDP = User Datagram Protocol
Le contrôle du robot est réaliser par un programme en langage python.
Ce programme permet au robot MRduino Wireless de
Il faut modifier votre SSID et mot de passe de votre réseau Wifi :
const char* ssid = "YOUR_SSID"; const char* pass = "YOU_PASSWORD";
Le programme complet :
#include <ESP8266WiFi.h> #include <WiFiUDP.h> #include <mrduino.h> static void read_receptionCommande(String Commande); int status = WL_IDLE_STATUS; const char* ssid = "YOUR_SSID"; // your network SSID (name) const char* pass = "YOUR_PASS"; // your network password unsigned int localPort = 12345; WiFiUDP Udp; int tries=0; void setup() { // Open serial communications and wait for port to open: Serial.begin(115200); // setting up Station AP WiFi.begin(ssid, pass); // Wait for connect to AP Serial.print("[Connecting]"); Serial.print(ssid); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); tries++; if (tries > 30) { break; } } Serial.println(); printWifiStatus(); Serial.println("Connected to wifi"); Serial.print("Udp server started at port "); Serial.println(localPort); Udp.begin(localPort); } void loop() { int noBytes = Udp.parsePacket(); String received_command = ""; byte packetBuffer[512]; if ( noBytes ) { Serial.print("received a packet"); // We've received a packet, read the data from it Udp.read(packetBuffer,noBytes); // read the packet into the buffer for (int i=1;i<=noBytes;i++) { received_command = received_command + char(packetBuffer[i - 1]); } // end for Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); Udp.endPacket(); // execution de la commande Serial.println(received_command); } // end if } void printWifiStatus() { // print the SSID of the network you're attached to: Serial.print("SSID: "); Serial.println(WiFi.SSID()); // print your WiFi shield's IP address: IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); }
Remarque : programme pour Windows
Ce programme permet de contrôler les mouvements du robot et les trois leds. Ne pas oublier de saisir l’adresse IP correct du robot.
https://youtu.be/DQLK-vAj6tc
https://youtu.be/Nj0HGHP0wqw
Article pour la configuration de la communication Wifi de la carte Pi Zero W en ligne de commande.
Version Raspian : April 2017 (Raspian Jessie Lite)
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB network={ ssid="YOUR_SSID" psk="YOUR_PASSWORD" key_mgmt=WPA-PSK }
sudo reboot
Une vidéo de l’association AMIC de Chambray lès Tours dans une classe de CM2 avec la programmation des robots MRduino Wireless. Le robot MRduino est programmable en langage graphique adapté aux enfants.
Un tutoriel pour contrôler le robot MRduino Wireless par UDP avec un programme python.
UDP = User Datagram Protocol
Le contrôle du robot est réaliser par un script en langage python.
Ce programme permet au robot MRduino Wireless de
Il faut modifier votre SSID et mot de passe de votre réseau Wifi :
const char* ssid = "YOUR_SSID"; const char* pass = "YOU_PASSWORD";
Le programme complet :
#include <ESP8266WiFi.h> #include <WiFiUDP.h> #include <mrduino.h> int status = WL_IDLE_STATUS; const char* ssid = "FREEMR"; const char* pass = "WIFINICO"; unsigned int localPort = 12345; byte packetBuffer[512]; WiFiUDP Udp; int tries=0; void setup() { Serial.begin(115200); // wifi init WiFi.begin(ssid, pass); Serial.print("[Connecting]"); Serial.print(ssid); // wait connexion while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); tries++; if (tries > 30) { break; } } Serial.println(); printWifiStatus(); // wifi connexion Serial.println("Connected to wifi"); Serial.print("Udp server started at port "); Serial.println(localPort); Udp.begin(localPort); } void loop() { int noBytes = Udp.parsePacket(); String received_command = ""; if ( noBytes ) { // read UDP packet Udp.read(packetBuffer,noBytes); for (int i=1;i<=noBytes;i++) { received_command = received_command + char(packetBuffer[i - 1]); } Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); Udp.endPacket(); // print command Serial.print("COMMANDE ="); Serial.println(received_command); } } void printWifiStatus() { Serial.print("SSID: "); Serial.println(WiFi.SSID()); IPAddress ip = WiFi.localIP(); Serial.print("IP Address: "); Serial.println(ip); }
Voici un script python pour envoyer une commande au robot :
import socket UDP_IP_ADDRESS = "192.168.0.20" UDP_PORT_NO = 12345 Message = "#LED,1,1!" clientSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) clientSock.sendto(Message, (UDP_IP_ADDRESS, UDP_PORT_NO))
import socket UDP_IP_ADDRESS = "192.168.0.20" UDP_PORT_NO = 12345 Message = "#MF,20!" clientSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) clientSock.sendto(Message, (UDP_IP_ADDRESS, UDP_PORT_NO))
https://www.youtube.com/watch?v=pjubJtC3ef8&t=135s
Article sous licence :