惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
腾讯CDC
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
Recent Announcements
Recent Announcements
A
About on SuperTechFans
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - slaughter

java api下载网站 国外好的软件测试网站 watir,ruby版本查看方法 - slaughter - 博客园 Watir隐藏IE运行的方法 Ruby对MS Access的操作 Eclipse下安装RDT (转)什么是Unicode?什么是UTF-8?(1) Ruby的库路径 - slaughter - 博客园 ruby下snmp-trap发包实例 - slaughter - 博客园 职业选择(转) ruby编码中碰到的一个诡异问题 - slaughter - 博客园 java读写文件(转) 在Java中操纵UDP(转) 在Java中使用UDP协议编程的相关类(转) 终于给宝宝确定了名字 RFT的对象识别技术 Ruby设置IE不可见 VC对EXCEL操作 Ruby转exe方法(转)
Ruby对于串口的设置实例 - slaughter - 博客园
slaughter · 2008-08-12 · via 博客园 - slaughter

这两天由于一直在寻找Ruby对于串口的控制方法,仅仅是希望能够通过com口对网络设备进行配置,但花费了两天才实验成功!

以下为一个简单实例(串口通过文件的方式进行操作)

目的:通过串口登陆到交换机,设置交换机名为S3760_3

f = File.open("com1:", "w+")
f.write("\n")
f.write("en")
f.write("\n")
f.write("con")
f.write("\n")
f.write("hostname S3760_3")

f.close

我进行了测试,调试通过!

以下也有其他的方法,但总体感觉比较麻烦,如果要实现比较复杂的操作大家可以参考: 

http://webscripts.softpedia.com/script/Server-Management/ruby-serialport-19279.html

http://wiki.rubygarden.org/Ruby/page/show/WindowsSerialPort