arduino笔记16:串口通讯

 

arduino可以通过串口和计算机进行通讯,我们能看到arduino上面有几个LED,其中LED旁边标有RX、TX。

RX:接收

TX :发出

 

变量存在arduino的内存里面,变量值可以改变,变量名字不变。

创建一个变量:

int currentTemperature;    //创建一个变量
int currentTemperature = 18;   //给变量一个初始值

注意创建变量需要注意,规避关键字,保留的字。

 

看一个arduino简单的程序:

这个程序用来使arduino上面的LED_BUILTIN点亮,LED_BUILTIN是指每一种开发板内部设置的和LED串联的接口。

/*
  Blink

  Turns an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
  it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
  the correct LED pin independent of which board is used.
  If you want to know what pin the on-board LED is connected to on your Arduino
  model, check the Technical Specs of your board at:
  https://www.ar
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值