01 2014 档案

【Raspberry Pi】crontab 定时任务
摘要:在linux上做定时任务一般用crond两种方法上文已列,但昨天写的crond命令却一直都没有运行,上网查,有说是环境变量的,也有说是时间问题的,都改过,但还没有效。今天再次认真读了一遍crontab的说明,发现昨天的命令理解错了,少打了一个星号,再改多打一个空格也不行,又改,在非root用户下貌似也不行。最后用root权限来写终于成功:sudo crontab -u root -e*/1 * * * * echo "try it" >> /tmp/test.txt*/1 * * * * python /home/pi/Myprogramme/get_tempe 阅读全文

posted @ 2014-01-29 21:57 colipso 阅读(1381) 评论(0) 推荐(0) 编辑

【Raspberry Pi】定时运行python程序读温湿度传感器数据&发邮件
摘要:1、定时执行脚本http://tech.it168.com/a2011/0707/1214/000001214830_all.shtml/sbin/service crond start //启动服务 /sbin/service crond stop //关闭服务 /sbin/service crond restart //重启服务 /sbin/service crond reload //重新载入配置 可以将这个服务在系统启动的时候也自动启动: 在/etc/rc.d/rc.local这个脚本的末尾加上: /sbin/service crond start 1.直接用cronta... 阅读全文

posted @ 2014-01-28 22:30 colipso 阅读(3395) 评论(0) 推荐(0) 编辑

【Raspberry Pi】修改时区
摘要:Raspberry Pi没有时钟模块,所以每次断电都会丢失时间,但它有联网获取时间的预设。但要修改默认时区http://outofmemory.cn/code-snippet/2899/shumei-pai-setting-shiqu-timesudo dpkg-reconfigure tzdata 阅读全文

posted @ 2014-01-28 21:32 colipso 阅读(572) 评论(0) 推荐(0) 编辑

【Raspberry Pi】DHT11 温度湿度传感器数据读取
摘要:时序图参考厂家说明书:DHT11数字湿温度传感器的原理和应用范例四个阵脚连接:VCC接3.3伏电源,Dout接GPIO口,我接的是物理12针脚,NC留空,GND接地。波折1:电阻被错接进了VCC,于是看了无数遍时序图,改了无数遍的驱动无论怎么改都是读不出数据。波折2:偶然看了网上的DHT11上拉电阻电路图才发现错误,于是果断去掉电阻。但为了显示传感器工作正常在电源和VCC间接了个发光二极管进去,数据倒是读出来了,但各种错误。(原因不明)去掉了电阻,去掉了led,优化了写的python,读数正常。再一次赞一个python。写DHT11的驱动需要注意时序之间很紧密,python执行任何程序都要花费 阅读全文

posted @ 2014-01-28 19:16 colipso 阅读(8992) 评论(1) 推荐(0) 编辑

【Raspberry Pi】读取DHT11温度湿度波折
摘要:从网上找到了DHT11厂家说明书,尝试用python根据时序图写数据获取驱动,但发现python的高层特性导致在做底层代码时例如控制20us时延这类需求就没什么好的办法。还是得回到C-wiringPi 控制gpio官网https://projects.drogon.net/raspberry-pi/wiringpi/http://blog.csdn.net/xukai871105/article/details/17881433 阅读全文

posted @ 2014-01-27 23:08 colipso 阅读(1021) 评论(0) 推荐(0) 编辑

【Raspberry Pi】webpy+mysql+GPIO 实现手机控制
摘要:1、mysqlhttp://dev.mysql.com/doc/refman/5.5/en/index.html安装sudo apt-get install updatesudo apt-get install mysql-server-5.5 mysql-client-5.52、安装web.pysudo apt-get install python-pipsudo pip install web.pyhtml模板$def with(todos) $if todos=='me': My test Hello World ... 阅读全文

posted @ 2014-01-25 17:09 colipso 阅读(1376) 评论(0) 推荐(0) 编辑

【python】正则表达式
摘要:http://www.jb51.net/article/15707.htm正则表达式语言相对小型和受限(功能有限),因此并非所有字符串处理都能用正则表达式完成。当然也有些任务可以用正则表达式完成,不过最终表达式会变得异常复杂。碰到这些情形时,编写 Python 代码进行处理可能反而更好;尽管 Python 代码比一个精巧的正则表达式要慢些,但它更易理解。简单模式我们将从最简单的正则表达式学习开始。由于正则表达式常用于字符串操作,那我们就从最常见的任务:字符匹配 下手。有关正则表达式底层的计算机科学上的详细解释(确定性和非确定性有限自动机),你可以查阅编写编译器相关的任何教科书。字符匹配大多数字 阅读全文

posted @ 2014-01-24 15:30 colipso 阅读(361) 评论(0) 推荐(0) 编辑

【Raspberry Pi】GPIO-发光二极管控制
摘要:注意事项:注意IO脚电流不能大于16mA,3V脚总电流不能大于50mA,所以两个二极管各上拉了400欧左右的电阻采用物理针脚7和9做控制其中output参数LOW为接通,HIGH为屏蔽 1 import RPi.GPIO as gpio 2 import time 3 gpio.setwarnings(False) 4 gpio.setmode(gpio.BOARD) 5 gpio.setup(7,gpio.OUT) 6 gpio.setup(11,gpio.OUT) 7 8 gpio.output(7,gpio.HIGH) 9 gpio.output(11,gpio.HIGH)10 11 . 阅读全文

posted @ 2014-01-23 22:23 colipso 阅读(534) 评论(0) 推荐(0) 编辑

【Raspberry pi】GPIO注意事项
摘要:1、GPIO编码的方法第三列是树莓派板子上的自然编号(左边引脚为1-15,右边引脚为2-26),RPi.GPIO.setmode(GPIO.BOARD)采用这列编号树莓派主芯片提供商Broadcom的编号方法,相当于调用了WiringPiSetupGpio()或RPi.GPIO.setmode(GPIO.BCM)采用这列编号wiringPi PinNameBoard PinBCM GPIO0GPIO 011171GPIO 112182GPIO 213213GPIO 315224GPIO 416235GPIO 518246GPIO 622257GPIO 7748SDA309SCL5110CE02 阅读全文

posted @ 2014-01-23 21:24 colipso 阅读(2825) 评论(0) 推荐(0) 编辑

【Python】Webpy
摘要:http://webpy.org/install.zh-cn官网学习,对于No socket could be created 一般是默认的8080端口已经被某些服务占用,可以换一个端口。 阅读全文

posted @ 2014-01-23 16:17 colipso 阅读(304) 评论(0) 推荐(0) 编辑

【Raspberry pi】GPIO使用指南
摘要:http://www.cnblogs.com/qtsharp/archive/2013/02/28/2936800.html树莓派RaspberryPi的RPi.GPIO使用指南Python操作树莓派GPIO的必要准备sudo apt-get install python-setuptoolssudo easy_install -U distributesudo apt-get install python-devsudo easy_install RPi.GPIO树莓派GPIO定义图PRi.GPIO的使用示例12345678910111213importRPi.GPIOimporttimeR 阅读全文

posted @ 2014-01-22 22:12 colipso 阅读(670) 评论(0) 推荐(0) 编辑

【Raspberry pi】python ide-spyder
摘要:sudo apt-get install spyder简单 明了 阅读全文

posted @ 2014-01-22 22:09 colipso 阅读(533) 评论(0) 推荐(0) 编辑

【Raspberry pi】set up an ftp server
摘要:http://www.debian-administration.org/articles/228As a means of distributing large collections of files FTP is still a popular choice, despite the rise of bittorrent, and the growing number of HTTP servers.FTP is an often overlooked method of storing and giving access to files, in many cases FTP serv 阅读全文

posted @ 2014-01-22 21:48 colipso 阅读(368) 评论(0) 推荐(0) 编辑

【Raspberry pi】系统安装及基础配置
摘要:1、系统安装见官网:http://www.raspberrypi.org/quick-start-guide2、基础配置转载自http://www.eeboard.com/bbs/thread-5191-1-1.html1. Q:树莓派怎么启动? A:使用win32diskimager将系统镜img文件写入SD卡中,然后插到树莓派的卡槽中,上电,即可启动系统。需要注意的是,我最初使用的是TF小卡套上SD卡套来实现启动的,一开始也的确使用正常,后来在使用过程中发现系统无法启动,一度以为是RPI坏了,发回爱板网让小鸟帮我检测,得出结论是SD卡套的问题。这个卡套在电脑上读写的时候是正常的,但是... 阅读全文

posted @ 2014-01-22 20:57 colipso 阅读(3683) 评论(0) 推荐(1) 编辑

【python】字符串编码问题
摘要:参考:http://blog.csdn.net/tingsking18/article/details/4033645python内部的字符串是以unicode来编码decode函数用来将其他编码解码为unicodeencode函数将unicode编码为指定的编码类型,例如gbk,utf-8# -*- coding: utf-8 -*-"""Created on Wed Jan 15 15:20:59 2014@author: hp"""import urllib2import reimport timeimport jiebaurl 阅读全文

posted @ 2014-01-16 16:59 colipso 阅读(354) 评论(0) 推荐(0) 编辑

【python】获取网页中中文内容并分词
摘要:1 # -*- coding: utf-8 -*- 2 3 import urllib2 4 import re 5 import time 6 import jieba 7 8 9 url="http://www.baidu.com"10 html=urllib2.urlopen(url).read()11 html=unicode(html,'utf-8')12 word=re.findall(ur"[\u4e00-\u9fa5]+",html)13 14 s=""15 for w in word:16 s+=w1 阅读全文

posted @ 2014-01-15 17:25 colipso 阅读(6826) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示