简体   繁体   English

通过minicom超级终端将数据插入Mysql

[英]Insert data to Mysql via minicom hyperterminal

I will describe my project and I would like some directions or steps of how can I do it. 我将描述我的项目,我想一些如何做的指导或步骤。 I am using Raspberry Pi with Raspian(like Debian). 我正在将Raspberry Pi与Raspian(例如Debian)一起使用。 I connected a TTL device via USB which gives me some results (say name, surname etc) in my hyperterminal (Cutecom or minicom I have them both). 我通过USB连接了TTL设备,从而在超级终端(Cutecom或minicom中都得到了它们)为我提供了一些结果(例如名称,姓氏等)。 It gives me different results every 10 seconds. 每10秒给我不同的结果。 I would like to save these results in a mysql database. 我想将这些结果保存在mysql数据库中。 I installed mysql and I think the next step is to create a table with values (name, surname etc). 我安装了mysql,我认为下一步是创建带有值(名称,姓氏等)的表。 After that the next step in my opinion is to find a way how to connect it with my hyperterminal to get the next and save them in the database. 之后,我认为下一步是找到一种方法,将其与我的超级终端连接以获取下一个并将其保存在数据库中。 Is there any code in C++ to do that or maybe some examples with this kind of connections? C ++中是否有任何代码可以执行此操作,或者是否有使用这种连接的示例? I am using Codeblocks as IDE. 我正在使用Codeblocks作为IDE。

Hyperterminal is a MSWindows product - not a generic term - while cutecom and minicom are Linux/POSIX terminal emulators. 超级终端是MSWindows产品(不是通用术语),而cutecom和minicom是Linux / POSIX终端仿真器。 You don't say where the MySQL database is nor what os is on the device where you are running the terminal emulator. 您没有说MySQL数据库在哪里,也没有说运行终端仿真器的设备上的操作系统是什么。

But assuming that the mysql db resides on a seperate machine, running some sort of unix, and the only option you have for connecting to the raspberry-pi is via a TTY connection (ie you can't run SliP/ppp) then just about any programming language is capable of talking to the raspberry pi unit - you're just writing to and reading from a stream device. 但是假设mysql db驻留在单独的计算机上,并运行某种类型的unix,并且连接到raspberry-pi的唯一选择是通过T​​TY连接(即,您无法运行SliP / ppp),那么大约任何编程语言都能够与树莓派pi对话-您只需要在流设备上进行写入和读取即可。 The only complication is that you may need to set some ioctls for the baud rate / flow control (if it's Linux, then have a look at the setserial util). 唯一的麻烦是您可能需要为波特率/流控制设置一些ioctl(如果是Linux,则请看setserial util)。

OTOH it may be a lot simpler (and it's certainly a lot more flexible) to use a TCP/IP connection - ppp and slip will implement this over a serial line. OTOH使用TCP / IP连接可能要简单得多(当然也要灵活得多)-ppp和slip将通过串行线路实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM