“力传感器”的版本间的差异

来自Labplus盛思维基百科
跳转至: 导航搜索
使用教程
 
(未显示另一用户的1个中间版本)
第8行: 第8行:
 
* 工作电压:VCC 3.3-5V
 
* 工作电压:VCC 3.3-5V
 
* I2C数字信号输出
 
* I2C数字信号输出
* 力范围 :-50~50 N
+
* 力范围 :0~20 N
 
* 解析度: 0.01
 
* 解析度: 0.01
 
* 精度: 1%
 
* 精度: 1%
第32行: 第32行:
 
== 使用教程 ==
 
== 使用教程 ==
  
在程序编程中需要注意拨动开关地址和程序中的地址一致!
+
1、在程序编程中需要注意拨动开关地址和程序中的地址一致!
 +
 
 +
2、力传感器中间按钮为置零按钮,当力传感器固定在被测状态后,即测量数据前需按下置零按键对传感器进行校准。
 +
 
 +
=== <font size=3px>掌控板</font> ===
 +
==== 图形化编程 ====
 +
{|
 +
|-
 +
| [[文件:力.png |900px|居中|无框]]
 +
|}
 +
==== 代码编程 ====
 +
{{DelveBit_mPython}}
  
 
=== <font size=3px>Arduino</font>  ===
 
=== <font size=3px>Arduino</font>  ===
  
 
{{DelveBit_arduino}}
 
{{DelveBit_arduino}}
 
=== <font size=3px>掌控板</font> ===
 
 
{{DelveBit_mPython}}
 
  
 
=== <font size=3px>microbit</font> ===
 
=== <font size=3px>microbit</font> ===

2020年6月30日 (二) 16:02的最新版本

blue:bit-力传感器

概述

用于检测量力的大小的I2C通讯类的传感器

技术参数

  • 工作电压:VCC 3.3-5V
  • I2C数字信号输出
  • 力范围 :0~20 N
  • 解析度: 0.01
  • 精度: 1%
  • 模块尺寸:46x72x7.5mm

引脚定义/接口说明

VCC 电源
SDA I2C数据
SCL I2C时钟
GND
  • 拨动开关,可选择模块的I2C地址,用于避免与其他I2C设备地址冲突。注意,重新选择I2C地址后,需要重新上电才能生效!

使用教程

1、在程序编程中需要注意拨动开关地址和程序中的地址一致!

2、力传感器中间按钮为置零按钮,当力传感器固定在被测状态后,即测量数据前需按下置零按键对传感器进行校准。

掌控板

图形化编程

力.png

代码编程

from mpython import *                   # 导入mpython
import bluebit                          # 导入bluebit 模块

meter=bluebit.DelveBit(0x60)            # 实例模块,根据实际I2C地址修改

while True:
    value = meter.common_measure()      # 测量
    print("measure: %f" %value)
    sleep_ms(200)

Arduino

#include <Wire.h>
int reading = 0;
void GetSensorValue(char address)
{
    Wire.requestFrom(address, 2); 
    if (2 <= Wire.available())
    {
       reading = Wire.read();  // receive high byte (overwrites previous reading)
       reading = reading << 8;    // shift high byte to be high 8 bits
       reading |= Wire.read(); // receive low byte as lower 8 bits
       Serial.println(reading);   // print the reading
    } 
}

void setup()
{
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop()
{
   GetSensorValue(0x63);
}

microbit

应用案例

FAQ

版本历史记录

Version Date 新增/删除/修复