三轮车加封闭车厢成了快递公司的标配,除了糊满黄色包装胶带的形象,发挥一下自己的创造力也是个不错的载体。
作者: 孟繁永
-
获取汉字的十六进制编码
public static string Str2Hex(string s)
{
string result = string.Empty;byte[] arrByte = System.Text.Encoding.GetEncoding(“GB2312”).GetBytes(s);
for (int i = 0; i < arrByte.Length; i++)
{
result += “0x” + System.Convert.ToString(arrByte[i], 16).ToUpper() + “,”; //Convert.ToString(byte, 16)把byte转化成十六进制string
}return result;
} -
防水 超声波测距模块 一体化超声波DYP-ME007Y-TX串口输出
在淘宝“高校基地”店买了一个http://item.taobao.com/item.htm?spm=a1z0k.6846101.1130973605.d4915209.SAObbz&id=36884805726,还有一种是PWM输出,这个代码比较多,就是最普遍的发送命令,然后等待信号,再计时,用声速推算距离,但是TX输出把我搞乱了。
终于在http://forum.arduino.cc/index.php?topic=88388.5;wap2找到了答案:
#include <SoftwareSerial.h>
// TX_PIN is not used by the sensor, since that the it only transmits!
#define PING_RX_PIN 6
#define PING_TX_PIN 7SoftwareSerial mySerial(PING_RX_PIN, PING_TX_PIN);
long inches = 0, mili = 0;
byte mybuffer[4] = {0};
byte bitpos = 0;void setup() {
Serial.begin(9600);mySerial.begin(9600);
}void loop() {
bitpos = 0;
while (mySerial.available()) {
// the first byte is ALWAYS 0xFF and I’m not using the checksum (last byte)
// if your print the mySerial.read() data as HEX until it is not available, you will get several measures for the distance (FF-XX-XX-XX-FF-YY-YY-YY-FF-…). I think that is some kind of internal buffer, so I’m only considering the first 4 bytes in the sequence (which I hope that are the most recent! 😀 )
if (bitpos < 4) {
mybuffer[bitpos++] = mySerial.read();
} else break;
}
mySerial.flush(); // discard older values in the next readmili = mybuffer[1]<<8 | mybuffer[2]; // 0x– : 0xb3b2 : 0xb1b0 : 0x–
inches = 0.0393700787 * mili;
Serial.print(“PING: “);
Serial.print(inches);
Serial.print(“in, “);
Serial.print(mili);
Serial.print(“mili”);delay(100);
}说明:模块每次输出一帧,含4个8位数据,帧格式为:0XFF+H_DATA+L_DATA+SUM
1、0XFF: 为一帧开始数据,用于判断。
2、H_DARA:距离数据的高8位。
3、L_DATA:距离数据的低8位。
4、SUM: 数据和用于交验。其0XFF+H_DATA+L_DATA=SUM(仅低8位)
5、H_DATA与L_DATA合成16位数据,即以毫米为单位的距离值。
注意:模块检测最小距离为30cm,在30cm内有物体,将获得不准确信号。
以上代码中没有做SUM校验
-
Arduino Yún与DFR0265(IO Expansion Shield for Arduino V7)不兼容解决办法
如图,因为Yun的网线口比之前的板子挨着引脚近,所以V7插不上去,研究一番,决定加一层排母,垫高一些再插扩展板。最终选择
1.http://item.taobao.com/item.htm?id=20747855300 1个;
2.http://item.taobao.com/item.htm?id=20747511841 2个;
3.http://item.taobao.com/item.htm?id=20747903210 1个;
4.http://item.taobao.com/item.htm?id=20802935165 1个。
另外还想把这些排母焊到一层板子上,不过单买一个洞洞板运费不划算,回头想好了再说。
-
BugNet Issue Tracker域帐号配置说明
网站安装时只需要修改web.config中的数据库连接,其他不变,主要是<authentication mode=”Forms”>保持不变。
1. 用默认的admin账号登录,初始密码是password,界面上有说明,登录后可以在系统设置中修改;
2. 添加一个域帐号作为切换到域帐号登录模式后的管理员账号,新建用户,Admin->User Accounts->Create New User->User Name的格式为domain\username,具体如ccppg\mengfanyong,其他随便填,密码勾选Random Password; (更多…)