how to pass data from a code on Arduino IDE to matlab
Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
0 votes
Partagez un lien vers cette question
Réponse acceptée
0 votes
Partagez un lien vers cette réponse
8 commentaires
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
- the arduino can be configured as a TCP server, and you can use tcpclient from basic MATLAB to connect to it. TCP is a "reliable" protocol: if errors are detected in transmission, the lower layers will automatically cause the data to be re-sent until it gets through (or you time out.) If packets are somehow received out of order, the interface will automatically reorder them. If a packet goes missing, it could potentially be a while before it is properly recovered. Because of this, TCP over unreliable networks such as WiFi is often considered unsuitable for real-time systems.
- Or, very much the same as above, but use tcpclient from the Instrument Control Toolbox
- You could flip the direction and have the arduino be the TCP client and MATLAB act as the TCP server. This needs tcpserver from the Instrument Control Toolbox
- instead of using TCP you could use udpport from the Instrument Control toolbox. UDP is classified as "unreliable". Any step in the path is permitted to drop a UDP packet if needed, and there is nothing in the UDP protocol itself that will try to recover the missing information. If you were constantly transmitting a stream of position updates (for example) and the most important point was that the MATLAB side had access to the latest available position information, rather than that it needed all the position information, then UDP can be good. The arduino would send the latest information, it would either get there are not, and either way the arduino would send newer information as soon as it had it.
- there is a File Exchange Contribution that can handle TCP and UDP using external software (without requiring the Instrument Control Toolbox)
- you can require an initialization step where the device is attached through USB to initialize and program (and perhaps get flight path or something like that); after that you disconnect without rebooting
- you can configure a static IP address as part of the saved information to be loaded as part of the arduino power up
- you can configure the arduino to use DHCP; see the tutorial at https://assiss.github.io/arduino-zhcn/cn/Tutorial/DhcpAddressPrinter.html . This requires that your host has been configured as a DHCP server... or at least that something on your 'net has been configured as a DHCP pool. See for example https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/install-configure-dhcp-server-workgroup and https://support.atlona.com/hc/en-us/articles/115001288894-KB01257-How-to-turn-your-computer-Windows-into-a-DHCP-server-to-give-your-Atlona-unit-an-IP-address . My internet connection has a built-in WiFi so my internet connection runs a DHCP server already.
Partagez un lien vers ce commentaire
Partagez un lien vers ce commentaire
Plus de réponses (0)
Catégories
En savoir plus sur Arduino Hardware dans Centre d'aide et File Exchange
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
