由于网上很多配置wifi的方式在我的伽利略开发板上都行不通,最后终于找到这个可以用的“冷门”办法: 系统配置 开发板: Intel Galileo gen2 无线网卡:PCI-e intel wifi link 5100 开发板系统: EGLIBC based Linux(download) 所用工具 硬件: usb无线网卡或者pci-e接口的无线网卡。 (注意如果你用的是和我一样的pci-e网卡,注意顺便买来天线接上,不然信号贼弱,这种网卡不接天线是不行的。) 软件: comman(开发板的完整版linux已经内置) 参考: 《connman百度百科》( http://baike.baidu.com/link?url=3C6RQqswxVvGMxNy7XA1-bWUBU6W0G7_Rvvsv2DRyv04nontgZ9oX7MRgeeNvMuRmjRMqf75_tqspSgjhb8Ysa )

紧接上篇文章(《Galileo开发板+微信公众平台实现简单的物联网家庭监控》( http://blog.jcix.top/2015-11-27/galileo_wechat/ ) ), 以下功能做了改进: * 实现了Galileo开发板上用USB摄像头+python版opencv监控并通过微信公众平台进行异常报警的功能。 * 通过connman实现了wifi网络的自动连接和随时修改功能。 * 通过post到服务器,实现了微信控制led灯亮、灭或者光控的功能。 视频监控功能的实现 (完整代码在github: https://github.com/zhangjaycee/galileo_pys/blob/master/cam_wechat.py ) 1.图像采集 galileo支持python的opencv库,这给简单的图像处理提供了极大的便利。 图像采集: cap = cv2.VideoCapture(0)#打开摄像头 cap.set(3,320) cap.set(4,240) while True: ret, frame = cap.read() 2.图像处理 我们要做键控,所以可以记录第一帧,然后通过帧间差别进行报警。 cap = cv2.VideoCapture(0) <!–more–> cap.set(3,320) cap.set(4,240) avg = None lastUploaded = datetime.datetime.now() motionCounter = 0 normal_count = 0 start_flag = 0 time.sleep(10) while True: […]

题目一: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid. The brackets must close in the correct order, “()” and “()[]{}” are all valid but “(]” and “([)]” are not. 大意:给定一个字符串,只包含”(){}[]”这些字符,判断字符串的括号是否都匹配。 思路 显然是用栈的思想做。 代码 (Python) class Solution(object): def isValid(self, s): “”” :type s: […]

题目一 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 大意:合并两个列表,返回一个新的列表,新的列表要把前边给定的两个列表链接起来。 思路: 其实就是把两个有序列表变成一个有序列表,只要维护两个指针,分别将当前最小的数复制到第三个列表中,然后将相应指针后移即可。道理很简单。 需要注意到是,python中,如果一个变量等于一个列表(比如,list1为一个列表,定义a1 = list1),则这个变量(a1)其实类似c中的指针的概念(a1和list1等价,都是“指针”),并不是拷贝了这个列表(如要实现拷贝复制,可以写a1 = list1[:])。 对于本题,这样的语法其实产生了两种写法,(见下边小节)。对于本题,两种写法都对,第一种写法比较简洁,但是却改变了原来的l1和l2列表,因为p3指针赋值的时候,直接用了l1或者l2的节点,那么下一次赋值的时候,便改变了这个节点的next指针。第二种写法采用了oj所定义的ListNode类的构造函数,直接用符合要求的l1或者l2的节点的val值创建一个新的node链接在l3后边,所以不改变原先的l1和l2列表。 所以,具体用哪一种,要根据知己需求定。 代码1(python) # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = […]

题目 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is: “((()))”, “(()())”, “(())()”, “()(())”, “()()()” 大意:给定n对括号,写一个函数来生成所有正确的配对串。 思路 生成所有的可能,然后注意检测是不是符合要求。 ##代码 (Python) class Solution(object): def isValid(self, s): “”” :type s: str <!–more–> :rtype: bool “”” l = [‘0’] for ch in […]

题目一 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. You may not modify the values in the list, only nodes itself can be changed. × 大意: 给定一个链表,依次交换两个相邻节点,并返回头节点。 比如: 1->2->3->4 交换后应该为 2->1->4->3. 思路 […]